Bird
Raised Fist0

Which search_after value correctly fetches the next page after user_id=42 and timestamp=1680000000?

hard🚀 Application Q15 of Q15
Elasticsearch - Advanced Patterns
You want to paginate through a large dataset sorted by user_id (ascending) and then timestamp (descending). Which search_after value correctly fetches the next page after user_id=42 and timestamp=1680000000?
A[42, 1680000000]
B[42, -1680000000]
C[1680000000, 42]
D["42", "1680000000"]
Step-by-Step Solution
Solution:
  1. Step 1: Understand sort order and search_after values

    The sort is by user_id ascending, then timestamp descending. The search_after array must match this order.
  2. Step 2: Match values to sort order

    The correct search_after is an array with user_id first, then timestamp. Since timestamp is descending, the value is used as is (no negation).
  3. Final Answer:

    [42, 1680000000] -> Option A
  4. Quick Check:

    search_after array matches sort fields order [OK]
Quick Trick: search_after array order matches sort fields order exactly [OK]
Common Mistakes:
MISTAKES
  • Reversing order of values in search_after
  • Negating timestamp for descending sort
  • Using strings instead of numbers without need

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes