Bird
0
0

Identify the error in this Elasticsearch sort clause:

medium📝 Debug Q6 of 15
Elasticsearch - Search Results and Scoring
Identify the error in this Elasticsearch sort clause:
{
  "sort": [{"price": {"order": "ascending"}}]
}
AThe order key is missing
BThe order value should be "asc" instead of "ascending"
CThe price field must be inside a nested object
DThe sort parameter must be a string, not an object
Step-by-Step Solution
Solution:
  1. Step 1: Check valid order values

    Elasticsearch accepts "asc" or "desc" as order values, not "ascending" or "descending".
  2. Step 2: Identify the error

    The order value "ascending" is invalid and causes a syntax error.
  3. Final Answer:

    The order value should be "asc" instead of "ascending" -> Option B
  4. Quick Check:

    Order must be "asc" or "desc" [OK]
Quick Trick: Use "asc" or "desc" for order values only [OK]
Common Mistakes:
MISTAKES
  • Using full words like "ascending"
  • Misplacing order key
  • Using wrong data types for sort

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes