Chapter 7. Exploring your data with aggregations

 

This chapter covers

  • Metrics aggregations
  • Single and multi-bucket aggregations
  • Nesting aggregations
  • Relations among queries, filters, and aggregations

So far in this book, we’ve concentrated on the use case of indexing and searching: you have many documents and the user wants to find the most relevant matches to some keywords. There are more and more use cases where users aren’t interested in specific results. Instead, they want to get statistics from a set of documents. These statistics might be hot topics for news, revenue trends for different products, the number of unique visitors to your website, and much more.

Aggregations in Elasticsearch solve this problem by loading the documents matching your search and doing all sorts of computations, such as counting the terms of a string field or calculating the average on a numeric field. To look at how aggregations work, we’ll use an example from the get-together site you’ve worked with in previous chapters: a user entering your site may not know what groups to look for. To give the user something to start with, you could make the UI show the most popular tags for existing groups of your get-together site, as illustrated in figure 7.1.

Figure 7.1. Example use case of aggregations: top tags for get-together groups

7.1. Understanding the anatomy of an aggregation

7.2. Metrics aggregations

7.3. Multi-bucket aggregations

7.4. Nesting aggregations

7.5. Summary

sitemap