Range query
📖 Scenario: You have a collection of products in an online store. Each product has a price. You want to find products within a certain price range.
🎯 Goal: Build an Elasticsearch range query to find products priced between 50 and 150.
📋 What You'll Learn
Create an Elasticsearch index mapping with a
price field of type float.Add a configuration variable for the price range minimum and maximum.
Write a range query using the
range keyword with gte and lte for the price field.Print the final query JSON.
💡 Why This Matters
🌍 Real World
Range queries are used in search engines to filter results by numbers like price, date, or ratings.
💼 Career
Knowing how to write range queries is important for roles involving search, data filtering, and Elasticsearch administration.
Progress0 / 4 steps