Challenge: Aggregations

Test your aggregation writing skills in Elasticsearch.

Challenge

You are working with a dataset of movie information stored in Elasticsearch. The dataset includes several attributes for each movie, such as title, lifetime_gross, year, studio, rating, runtime, budget, releaseDate, voteAvg, and voteCount. Your task is to perform different aggregation queries in Elasticsearch.

The movies index comprises several fields with their respective data types and purposes, including:

  • title: This text field stores the title of the movie. It allows full-text search capabilities, enabling users to efficiently search for movies based on their titles.

  • lifetime_gross: This field stores the total amount of money the movie has made in its lifetime. It is represented as an integer type, allowing for numeric calculations and range-based searches, such as finding movies with specific earnings.

  • year: The year field represents the year the movie was released. It is stored as an integer data type.

  • studio: This field contains the name of the studio that produced the movie. It is stored as a text type, enabling full-text search capabilities.

  • rating: The rating field stores the rating of the movie (PG-13, R, etc.). It is stored as a text type.

  • runtime: This field represents the length of the movie in minutes. It is stored as an integer.

  • budget: This field contains the budget of the movie in USD. It is stored as an integer.

  • releaseDate: This field indicates the date the movie was released. It is stored as a date type.

  • voteAvg: This field represents the average rating of the movie from the users. It is stored as a floating-point number.

  • voteCount: This field stores the total number of votes the movie has received from users. It is stored as an integer type.

Get hands-on with 1400+ tech skills courses.