Bird
0
0

Given this Elasticsearch query, what documents will it match?

medium📝 Predict Output Q13 of 15
Elasticsearch - Basic Search Queries
Given this Elasticsearch query, what documents will it match?
{ "query": { "range": { "age": { "gt": 30, "lte": 40 } } } }
ADocuments where age is greater than 30 and less than or equal to 40.
BDocuments where age is between 30 and 40 inclusive.
CDocuments where age is greater than or equal to 30 and less than 40.
DDocuments where age is exactly 30 or 40.
Step-by-Step Solution
Solution:
  1. Step 1: Interpret the range operators

    "gt": 30 means age > 30 (not including 30), "lte": 40 means age ≤ 40 (including 40).
  2. Step 2: Understand the matching documents

    Documents with age greater than 30 and less than or equal to 40 will match.
  3. Final Answer:

    Documents where age is greater than 30 and less than or equal to 40. -> Option A
  4. Quick Check:

    gt=30 and lte=40 means age >30 and ≤ 40 [OK]
Quick Trick: Remember gt excludes boundary, lte includes boundary [OK]
Common Mistakes:
MISTAKES
  • Confusing gt with gte or lte with lt
  • Assuming boundaries are inclusive when they are not
  • Misreading the query operators

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes