聚合是基于搜索的结果进行汇总,但在实际中,我发现搜索结果中不存在的数据,在聚合里却出现了
和 key 为WXAPP的
{
"size": 0,
"query": {
"bool": {
"filter": [
{
"term": {
"esType": "recognize"
}
}
]
}
},
"aggregations": {
"platformAggs": {
"terms": {
"field": "platform",
"size": 5,
"min_doc_count": 0
}
}
}
}
结果:"aggregations": {
"platformAggs": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "HTML",
"doc_count": 49155
}
,
{
"key": "ANDROID",
"doc_count": 90
}
,
{
"key": "IOS",
"doc_count": 25
}
,
{
"key": "",
"doc_count": 0
}
,
{
"key": "WXAPP",
"doc_count": 0
}
]
}
}
在查询条件下,并不存在key 为""和 key 为WXAPP的
2 个回复
walter123 - IT
赞同来自: psc0606 、redhat
psc0606
赞同来自: