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
明白了。我編輯了我的答案以滿足您的要求。 –