WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
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.