Solution: Aggregation
Review the solutions to the aggregation challenge.
We'll cover the following
- Aggregation 1: Average lifetime gross by studio
- Aggregation 2: Number of movies released each year
- Aggregation 3: Average budget vs. average lifetime gross by year
- Aggregation 4: Runtime distribution
- Aggregation 5: Top-rated movies by rating
- Aggregation 6: Rating breakdown of movies by year
- Aggregation 7: Total budget by studio
- Kibana widget
Aggregation 1: Average lifetime gross by studio
To solve this challenge, we can use the terms
aggregation on the studio
attribute combined with the avg
aggregation lifetime_gross
.
To implement this aggregation, we will initiate a _search
request targeting the movie
index, and within the request body, we will define the aggregation structure. Initially, we will specify aggs
as terms
and designate the field
as studio
. Nested within this aggregation, we will include another aggs
section labeled as avg
, where we will specify the field
as lifetime_gross
.
Get hands-on with 1400+ tech skills courses.