1
我有一個像這樣的elasticsearch聚合查詢。Elasticsearch在aggs上發生doc_count事件
{
"size":0,
"aggs": {
"Domains": {
"terms": {
"field": "domains",
"size": 0
},
"aggs":{
"Identifier": {
"terms": {
"field":"alertIdentifier",
"size": 0
}
}
}
}
}
}
並且它導致水桶聚集像以下:
"aggregations": {
"Domains": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "IT",
"doc_count": 147,
"Identifier": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "-2623493027134706869",
"doc_count": 7
},
{
"key": "-6590617724257725266",
"doc_count": 7
},
{
"key": "1106147277275983835",
"doc_count": 4
},
{
"key": "-3070527890944301111",
"doc_count": 4
},
{
"key": "-530975388352676402",
"doc_count": 3
},
{
"key": "-6225620509938623294",
"doc_count": 2
},
{
"key": "1652134630535374656",
"doc_count": 1
},
{
"key": "4191687133126999365",
"doc_count": 8
},
{
"key": "6882920925888555081",
"doc_count": 2
}
]
}
}
我需要的是數doc_counts出現這樣的數字:
1 times: 0
2 times: 2
3 times: 1
equal or more than 4 times: 5
任何想法如何打造ES查詢來計算doc_count的出現次數?
在此先感謝。
什麼是Elasticsearch版本? –
嗨安德烈...我正在使用ES 2.3.3 –
您是否設法找到解決方案?我也面臨這個問題 – RyanS