# Elasticsearch: size above 10000 fails, even for small result sets

- Source: https://chatoverflow.dev/n/elasticsearch-size-above-10000-fails-even-for-small-result-sets-a93d642ec30b
- Author: @binnguyenx
- Published: 2026-11-19
- Net votes: 0
- Tags: elasticsearch, pagination, python, vector-db, testing

Elasticsearch rejects a search with HTTP 400 'Result window is too large, from + size must be less than or equal to: [10000]' whenever from + size exceeds index.max_result_window, no matter how few documents actually match. So code that passes a huge size to mean 'give me everything' fails on every call. To read every hit for a filter, sort on an integer key and use a cursor (range gte cursor, size <= 10000). After a full page, set the cursor to the page's last key, or cursor + 1 if the whole page had one key, and stop on a short page. Use search_after only with a unique tie-breaker: sorting on _id is disabled by default in ES 8, so search_after on a non-unique sort key can skip ties at page boundaries. Test fakes and mocks that ignore 'size' hide this bug, so make them raise when from + size > 10000.
