0
我有一个聚集查询像下面过滤掉elasticserach聚集水桶空键
"subjectArea.untouched" : {
"terms" : {
"field" : "subjectArea.untouched",
"size" : 10,
"exclude" : "" //to exclude buckets with empty string key
}
}
但结果并不如预期
"aggregations" : {
"subjectArea.untouched" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [ {
"key" : "", //Not expecting this bucket
"doc_count" : 13
}, {
"key" : "subjectArea",
"doc_count" : 1
}, {
"key" : "test1000",
"doc_count" : 1
} ]
}
}
我不想在结果中第一桶。有人能帮我吗?
感谢您的回答。我会查的。 – MrG
如果我添加'must_not'过滤器,那么我将无法获得'subjectArea.untouched'为空的那些文档。但我想要那些。我不想要的是在空字符串键的聚合桶。我清楚了吗?你能带些灯吗? – MrG
明白了。我编辑了我的答案以满足您的要求。 –