2017-08-15 49 views
0

的总和这是获取顶级结果我QueryDSL根据现场的count1弹性搜索:根据3场

{ 
    "query": { 
    "bool": { 
     "must": [], 
     "filter": { 
     "range": { 
      "@timestamp": { 
      "gte": "2017/08/01", 
      "lte": "2017/08/31", 
      "format": "yyyy/MM/dd||yyyy||yyyy" 
      } 
     } 
     }, 
     "filter": { 
     "range": { 
      "count1": { 
      "gt": 0 
      } 
     } 
     } 
    } 
    }, 
    "size": 0, 
    "aggs": { 
    "ch_agg": { 
     "terms": { 
     "field": "ChID", 
     "size": 30, 
     "order": { 
      "sum_agg": "desc" 
     } 
     }, 
     "aggs": { 
     "sum_agg": { 
      "sum": { 
      "field": "count1" 
      } 
     } 
     } 
    } 
    } 
} 

现在我有2总和返回降序我顶30个结果其他领域count2 & count3也。如何使之根据count1 + count2 + count3

回答