Elasticsearch 学习之子聚集过滤
1. 获取子聚合结果总数 { "size": 0, "aggs": { "msisdnAgg": { "terms": { "field": "msisdn" }, "aggs": { "tagAggs": { "terms": { "field": "tags" } }, "sum_of_rul": { "sum_bucket": { "buckets_path": "tagAggs>_count" } } } } } } 2. 获取子聚合结果总数大于指定数 { "size": 0, "aggs": { "msisdnAgg": { "terms": { "field": "msisdn" }, "aggs": { "tagAggs": { "terms": { "field": "tags" } }, "sum_of_rul": { "sum_bucket": { "buckets_path": "tagAggs>_count" } }, "orderNumber_count_filter": { "bucket_selector": { "buckets_path": { "orderNumberCount": "sum_of_rul" }, "script": "orderNumberCount > 2 " } } } } } }