elasticsearch - Elastic Search : Get top results according to sum of 3 fields -
this querydsl returns me top 30 results in descending order according sum of field count1
{ "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" } } } } } } now have 2 other fields count2 & count3 too. how modify query returns me top 30 documents according sum of count1 + count2 + count3
try add top-hits aggregation nested aggregation
Comments
Post a Comment