Elasticsearch Pagination: When to Use search_after Instead of from+size
Use search_after for sequential deep pagination and from+size for shallow pages within the result window.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Use search_after for sequential deep pagination and from+size for shallow pages within the result window.
Explore why Elasticsearch's from/size pagination hits a hard limit at 10,000 results and how search_after with a deterministic sort key provides unbounded, low‑memory paging. Includes a worked example using a point‑in‑time (PIT) cursor for consistent snapshots.
Compare Elasticsearch pagination methods for deep ordered reads: from/size, search_after with Point in Time, and Scroll API.
When Elasticsearch rejects page requests beyond 10,000 documents, switch from from/size to search_after for stable deep pagination without raising index.max_result_window.
from/size breaks past index.max_result_window because it is an offset. Here is how search_after with a point-in-time cursor and a tiebreaker sort keeps deep paging stable.
Deep pagination with from/size in Elasticsearch hurts performance. Search‑After lets you page linearly by passing the last hit’s sort values as a cursor. Learn how to set it up, test it, and understand its limits.