Bird
0
0

Examine this Elasticsearch pagination query and identify the issue:

medium📝 Debug Q6 of 15
Elasticsearch - Search Results and Scoring

Examine this Elasticsearch pagination query and identify the issue:

{ "from": 10, "size": -1 }

A"from" must be zero or positive, but negative values are allowed for "size".
B"from" cannot be greater than "size".
C"size" cannot be negative; it must be zero or positive.
DBoth "from" and "size" can be negative for reverse pagination.
Step-by-Step Solution
Solution:
  1. Step 1: Understand "size" parameter

    The "size" parameter defines how many results to return and must be zero or a positive integer.
  2. Step 2: Analyze the query

    The query uses "size": -1, which is invalid because negative sizes are not allowed.
  3. Final Answer:

    "size" cannot be negative; it must be zero or positive. -> Option C
  4. Quick Check:

    Negative "size" values cause errors in Elasticsearch queries. [OK]
Quick Trick: "size" must be >= 0; negatives cause errors [OK]
Common Mistakes:
MISTAKES
  • Assuming "size" can be negative for reverse pagination
  • Confusing "from" and "size" constraints
  • Believing "from" must be less than "size"

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes