How can I get hit with min date after aggregation?
I have aggregation by some field, then subAggregation(AggregationBuilders.min("createdDate")
with this date and then topHits
subAggregation. But it returns me 3 hits, not 1 with this value.
Asked
Active
Viewed 332 times
0

Squeez
- 919
- 2
- 12
- 30
1 Answers
0
Just use size
attribute of TopHits and set it to one. For more info, please consult https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html#_options_2

nefo_x
- 3,050
- 4
- 27
- 40