es聚合后求count的总和
作者:互联网
使用sum_bucket聚合
{
"size": 0,
"query": {
"match_all": {}
},
"aggregations": {
"questionRecommendAgg": {
"nested": {
"path": "messages"
},
"aggregations": {
"messagesAgg": {
"terms": {
"field": "messages.cards",
"size": 100
}
},
"sumMessagesAgg": {
"sum_bucket": {
"buckets_path": ["messagesAgg._count"]
}
}
}
}
}
}
标签:count,messagesAgg,后求,bucket,aggregations,path,sum,es,size 来源: https://blog.csdn.net/qq_35249342/article/details/119325081