提问要多花一点心思哦

请教下,聚合中 如何统计buckets中doc_count大于某个值的key数量

Elasticsearch | 作者 jasou1995 | 发布于2018年06月07日 | 阅读数:6824

这是当前使用的查询JSON{  
   "size": 0,  
   "aggs": {  
      "all_terms": {  
         "terms": {  
            "field": "url_regex",  
            "size": 30,  
             "min_doc_count": 5000  
         },  
         "aggs": {  
            "distinct_url": {  
               "cardinality": {   
                  "field": "url_regex"  
               }  
            }  
         }  
      },  
      "sum_of_rul": {  
         "sum_bucket": {  
            "buckets_path": "all_terms>distinct_url.value"  
         }  
      }  
   }  

现在的问题在统计出来的结果恒小于等于size size开得太大又会导致慢查询 
实测size=5000的时候查询需要将近10s 
size=10000的有时候ela直接挂掉 需要重启
整张表数据1000W左右
需要的结果是sum_of_rul这个值
已邀请:

hallywang

赞同来自:

{ "aggs" : { "tags" : { "terms" : { "field" : "tags", "min_doc_count": 10 } } } }
 

要回复问题请先登录注册