0

I have a query which include a function_score, I would like to execute the aggregations only on the first N elements ( sorted per _score ).

It is possible ? how ?

Thanks.

Wonay
  • 1,160
  • 13
  • 35
  • I think this [question](https://stackoverflow.com/questions/28896043/limit-elasticsearch-aggregation-to-top-n-query-results) can help you. – tomas Sep 12 '17 at 20:17
  • `shard_size` is limiting the quantity per shard. not total – Wonay Sep 12 '17 at 20:49
  • so I tried for `shard_size:1` and added a `min`/ `max` in my `aggregations` , the `min` , `max` doesnt match the documents returned in the `hits` so it is not using the `_score` to sort before doing the aggregations :/ – Wonay Sep 12 '17 at 21:12
  • The only thing I found is `min_score` but it is hard to have a hard coded threshold like that. – Wonay Sep 12 '17 at 21:48

0 Answers0