August 2019
Intermediate to advanced
560 pages
13h 41m
English
This is commonly used to group documents together and then use the size to limit the groups generated from the top hits. It can be used as the buckets generator for top-level aggregation. This example aims to find the top five morningstar_category based on the number of ETFs in the cf_etf index.
The top five categories are Diversified Emerging Mkts, Large Blend, Miscellaneous Region, Europe Stock, and Technology:
"aggs": {"category_top_hits": {"terms": {"field":"morningstar_category","size": 5},"aggs":{"category_top_hits": {"top_hits": {}}}}}
Read now
Unlock full access