Term-Level Queries: Range Query

Learn about the range query and how to utilize it.

Range query

A range query is a type of query that allows us to retrieve data within a specified range of values. It is used to filter data based on a range of values, such as numbers, dates, or strings. For example, we can perform a range query to retrieve all documents where the price field falls within the range of 20 to 50.

Range queries are often used in conjunction with other types of queries, such as search queries and aggregation queries. For example, we can perform a search query to find all the documents that contain the word "apple" and then perform a range query to filter the results by price. This allows us to find all documents that contain the word "apple" and have a price between 20 and 50.

Range queries can be very efficient because they only need to scan data within the specified range. This makes them a good choice for large datasets.

Get hands-on with 1200+ tech skills courses.