Top Hits aggregationedit

A top hits metric aggregation keeps track of the most relevant document being aggregated. This aggregator is intended to be used as a sub aggregator, so that the top matching documents can be aggregated per bucket.

The top hits aggregation can effectively be used to group result sets by certain fields via a bucket aggregation. One or more bucket aggregations determines by which properties a result set get sliced into.

Refer to the original docs for more information.