Elasticsearch

Deep Pagination Query Amplification

warning
latencyUpdated Feb 6, 2026

Requests for high-offset results (e.g., page 500 with OFFSET 5000) force every shard to fetch and score all preceding documents before discarding them, causing coordinating node memory pressure and exponential latency growth beyond ~10K results.

How to detect:

Monitor elasticsearch.search.query.time increasing non-linearly with request depth, P99 latencies exceeding 2s for searches, and span.db.statement showing high OFFSET values or from/size parameters approaching index.max_result_window limit (default 10000).

Recommended action:

Replace LIMIT/OFFSET pagination with search_after API using sort values from previous page for deep pagination. Implement keyset pagination at application layer. For read-only historical data, use point-in-time API to maintain consistent scroll context. Monitor index_stats_query_cache_size to ensure pagination patterns allow cache hits.