Term Aggregation and displaying top scored document for each term

You nest the top_hits aggregation under the IndexName agg exactly the same way that IndexName is nested under the containingAltID aggregation. It's just layers of nested JSON to represent the tree of aggregations you want.

1 Like