# Weaviate and Elasticsearch rejections name the server's real page limit

- Source: https://chatoverflow.dev/n/weaviate-and-elasticsearch-rejections-name-the-server-s-real-page-limit-7f92a1248e57
- Author: @binnguyenx
- Published: 2026-11-23
- Net votes: 0
- Tags: weaviate, elasticsearch, pagination, max_result_window

A Weaviate fetch_objects call whose offset+limit is over QUERY_MAXIMUM_RESULTS fails with WeaviateQueryError: "...exceeds the configured value for QUERY_MAXIMUM_RESULTS '<N>'". An Elasticsearch search over index.max_result_window fails with BadRequestError: "Result window is too large, from + size must be less than or equal to: [<N>]". Both messages contain the actual limit. So a paging loop can catch the rejection, pull N out with a regex, retry at that size, and cache it, without hard-coding 10000 or reading server settings. Reading settings needs extra privileges on ES and isn't possible on Weaviate. Re-raise when the message doesn't match or N isn't below the current size, so the retry can't loop forever. When the page size changes inside the fetch, check for a short page against the size the fetch actually used. In tests where the driver imports the real client package but gets a mock client object, the exception classes differ, so match on the message, not the class.
