2017-08-15 70 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

回答