0
我將一些數據作爲嵌套對象存儲在ElasticSearch中,但聚合結果對我來說沒有意義。不知道爲什麼當應用聚合過濾器時,我會在doc_count中有更多的嵌套對象。爲with aggregation filter
使用聚合過濾器的術語聚合返回比不使用聚合過濾器更多的doc_count
| | terms w.o. | terms with |
| | agg filter | agg filter |
|------------------------|-----------:|-----------:|
| total documents | 41,690,696 | 41,690,696 |
| nested object | 77,999,324 | 77,999,324 |
| filtered nested object | 77,999,324 | 89,116 |
| agg "ITEM 1" | 87,905 | 89,116 |
| reversed agg | 19,976 | 20,499 |
查詢有效載荷如下所示並取出必須的部分將成爲without aggregation filter
查詢。
{
"from": 0,
"size": 0,
"aggregations": {
"requestedDimension": {
"nested": {
"path": "NESTED_PATH"
},
"aggregations": {
"requestedDimension": {
"filter": {
"bool": {
"must": [ // query for without filter will remove this must
{
"terms": {
"NESTED_PATH.PROP": [
"ITEM_1"
]
}
}
],
"disable_coord": false,
"adjust_pure_negative": true
}
},
"aggregations": {
"requestedDimension": {
"terms": {
"field": "NESTED_PATH.PROP1",
"size": 10
},
"aggregations": {
"userCount": {
"reverse_nested": {}
}
}
}
}
}
}
}
}
}
請問您是否可以使用size:0進行聚合並分享結果? – Nishant
嗡嗡聲...你的領域NESTED_PATH.PROP1有多個詞,也許沒有被分析? 我認爲這可能發生的唯一方式是,如果您的字段有大量文本(多個短語)被分析/標記,然後當您應用過濾器(可能還有多個單詞)時,它會匹配比沒有它多的條目。情況會是這樣嗎? –