-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Elasticsearch 5.x Cookbook
By :

The top hit aggregation is different from the other aggregation types: all the previous aggregations have metric (simple values) or bucket values; the top hit aggregation returns buckets of search hits.
Generally, the top hit aggregation is used as a sub-aggregation, so that the top matching documents can be aggregated in buckets.
You need an up-and-running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.
To execute curl
via the command line, you need to install curl
for your operative system.
To correctly execute the following command, you need an index populated with the chapter_08/populate_aggregations.sh
script available in the online code.
For executing a top hit aggregation, we will perform the following steps:
We want to aggregate the document hits by the tag (tags
) and return only the name
field of the document with the maximum age (top_tag_hits...
Change the font size
Change margin width
Change background colour