0
如果我们在elasticsearch下列文件:在小惩罚结果的文件根据其内容
[
{'name': 'John', 'time': '2013-01-01 12:01:00'},
{'name': 'John', 'time': '2013-01-01 12:02:00'},
{'name': 'John', 'time': '2013-01-01 12:03:00'},
{'name': 'John', 'time': '2013-01-01 12:04:00'},
{'name': 'Harry', 'time': '2013-01-01 12:05:00'},
{'name': 'Fred', 'time': '2013-01-01 12:06:00'},
{'name': 'Fred', 'time': '2013-01-01 12:07:00'}
]
我们小面在“名称”字段中,我们会得到这样的事情:
"facets": {
"count_per_name": {
"_type": "terms",
"missing": 0,
"total": 7,
"other": 0,
"terms": [
{
"term": "John",
"count": 4
},
{
"term": "Fred",
"count": 2
},
{
"term": "Harry",
"count": 1
}
]
}
}
我的问题是这样的:是否有可能在elasticsearch中执行一个分面查询,将那些name
“John”的文档计为“half”文档?这将导致约翰的计数下降,从4比2,但弗雷德和哈利的保持不变:
"facets": {
"count_per_name": {
"_type": "terms",
"missing": 0,
"total": 5,
"other": 0,
"terms": [
{
"term": "John",
"count": 2
},
{
"term": "Fred",
"count": 2
},
{
"term": "Harry",
"count": 1
}
]
}
}