es聚合时统计buckets中key的数量
GET myindex/mytype/_search
{
"size": 0,
"query": {
"range": {
"DATE": {
"gte": "2018-01-01",
"lte": "2018-12-31"
}
}
},
"aggs": {
"ha": {
"terms": {
"field": "PNAME",
"size": 8000
},
"aggs": {
"NAME": {
"cardinality": {
"field": "PNAME"
}
}
}
},
"sum":{
"sum_bucket": {
"buckets_path": "ha>NAME.value"
}
}
}
}
posted on 2020-03-25 09:53 zhangfeitaimengle 阅读(3082) 评论(0) 编辑 收藏 举报