Skip to main content
InterviewHubPRO
Section Overview
Q40

Question 40 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

80%
Elasticsearch & Lucene (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

Deep Pagination at Scale: `from`/`size` limit vs `search_after` vs Scroll API.

senior LevelHTTP & REST APIs

In Simple Words:

  • from / size (The 10,000 Limit): Requesting from: 100000, size: 10 forces every shard to fetch 100,010 documents into memory and ship them to the coordinating node for sorting, crashing the node. Capped at index.max_result_window = 10000.
  • search_after (Recommended for Live Pagination): Uses the sort values of the last retrieved document as an index cursor. $O(1)$ memory consumption and blazing fast.
  • Scroll API: Designed exclusively for batch data exports (ETL). Deprecated for user-facing interactive searches because it keeps open search contexts in memory.