简体   繁体   中英

Aggregations and filtering with Elasticsearch

Using ES 1.5.2

Speaking strictly of aggregations, is it better for performance? The query/filter/aggregation returns the exact same result in both cases.

  • Filter query and then aggregate.

     { "size":0, "query": {}, "aggs": {} } 
  • Or filter inside the aggregate.

     { "size":0, "aggs": { "filter": { "query": {}, }, "aggs": {} } } 

The main difference between filtering and quering ist that filters do not affect scoring.

Filters only reduce the result set size, but there is no relevance scoring on the matched items at all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM