Bird
Raised Fist0

You want to run a very expensive aggregation query on a large dataset without timing out. Which approach using async search is best to get the final results efficiently?

hard🚀 Application Q15 of Q15
Elasticsearch - Advanced Patterns
You want to run a very expensive aggregation query on a large dataset without timing out. Which approach using async search is best to get the final results efficiently?
ARun a normal search with a very high <code>timeout</code> value to wait for results.
BStart async search with a long <code>wait_for_completion_timeout</code> and poll using the returned <code>id</code> until results are ready.
CStart async search and immediately request results without waiting for completion.
DRun the query multiple times with smaller timeouts and merge results manually.
Step-by-Step Solution
Solution:
  1. Step 1: Understand async search timeout and polling

    Setting a reasonable wait_for_completion_timeout lets the server try to finish quickly but returns control if it takes longer.
  2. Step 2: Use the returned id to poll for completion

    You can check the status later using the id until the results are ready, avoiding timeouts and blocking.
  3. Final Answer:

    Start async search with a long wait_for_completion_timeout and poll using the returned id until results are ready. -> Option B
  4. Quick Check:

    Async search + polling = efficient for expensive queries [OK]
Quick Trick: Use wait_for_completion_timeout + poll with id for big queries [OK]
Common Mistakes:
MISTAKES
  • Using normal search with high timeout risking app freeze
  • Requesting results immediately before completion
  • Manually merging partial results instead of async search

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes