Bird
Raised Fist0

You want to retrieve 10,000 documents using the Scroll API. Which approach is best to avoid memory issues and ensure all documents are retrieved?

hard🚀 Application Q15 of Q15
Elasticsearch - Advanced Patterns
You want to retrieve 10,000 documents using the Scroll API. Which approach is best to avoid memory issues and ensure all documents are retrieved?
AUse the Scroll API but do not specify the scroll parameter to speed up retrieval.
BSet size to 10,000 in a single search request without scrolling.
CFetch documents by IDs one by one using separate queries.
DUse a scroll time of 1 minute and fetch batches of 100 documents repeatedly until no hits remain.
Step-by-Step Solution
Solution:
  1. Step 1: Understand deep pagination with Scroll API

    Scroll API is designed to fetch large results in small batches with a scroll timeout to keep context alive.
  2. Step 2: Evaluate options for best practice

    Use a scroll time of 1 minute and fetch batches of 100 documents repeatedly until no hits remain. correctly uses scroll time and batch size to safely retrieve all documents. Set size to 10,000 in a single search request without scrolling. risks memory overload. Use the Scroll API but do not specify the scroll parameter to speed up retrieval. is invalid because scroll param is required. Fetch documents by IDs one by one using separate queries. is inefficient and slow.
  3. Final Answer:

    Use a scroll time of 1 minute and fetch batches of 100 documents repeatedly until no hits remain. -> Option D
  4. Quick Check:

    Scroll API + batch + scroll time = safe deep pagination [OK]
Quick Trick: Fetch in batches with scroll time to avoid overload [OK]
Common Mistakes:
MISTAKES
  • Requesting all documents at once causing memory errors
  • Omitting scroll parameter to speed up
  • Fetching documents individually instead of batches

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes