Bird
0
0

Which of the following is the correct syntax for a range query filtering documents where price is greater than or equal to 10 and less than 20?

easy📝 Syntax Q12 of 15
Elasticsearch - Basic Search Queries
Which of the following is the correct syntax for a range query filtering documents where price is greater than or equal to 10 and less than 20?
A{ "range": { "price": { "gte": 10, "lte": 20 } } }
B{ "range": { "price": { "gt": 10, "lte": 20 } } }
C{ "range": { "price": { "gt": 10, "lt": 20 } } }
D{ "range": { "price": { "gte": 10, "lt": 20 } } }
Step-by-Step Solution
Solution:
  1. Step 1: Identify the boundary conditions

    The question asks for price >= 10 and price < 20, which means gte:10 and lt:20.
  2. Step 2: Match syntax with conditions

    { "range": { "price": { "gte": 10, "lt": 20 } } } uses gte and lt correctly matching the condition.
  3. Final Answer:

    { "range": { "price": { "gte": 10, "lt": 20 } } } -> Option D
  4. Quick Check:

    gte=10 and lt=20 syntax = { "range": { "price": { "gte": 10, "lt": 20 } } } [OK]
Quick Trick: Match gte/gt and lte/lt exactly to the question limits [OK]
Common Mistakes:
MISTAKES
  • Mixing up gte with gt or lte with lt
  • Using wrong operators for boundaries
  • Syntax errors like missing braces

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes