From the course: Elasticsearch Essential Training
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Filtering aggregation - Elastic Stack Tutorial
From the course: Elasticsearch Essential Training
Filtering aggregation
- [Narrator] Imagine you are building an analytics dashboard and need to calculate the average price of in-stock products, or you want to know how many orders came from premium customer. In all these scenarios, basic aggregation won't solve the problem. You need to filter the aggregation. Let's just see how we can use the filter with the aggregation. Let's take an example where I want to calculate the average price of all the products, those are available in the stock. So in this case, I can again run the aggregation. However, this time I'm going to add the filter condition as well. I'm going to say that let's do the aggregation, and find out the average price, but filter out those are in the stock. So I'm using that in_stock attribute saying to be true. So this will give me the average price for all the products, those are available in the stock. Let's execute this, and there you go. If, let's say, if I'm just saying that I wanted to find the average price for all the products who…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.