Ensure correctness of Elasticsearch page size calculation
Elasticsearch allows specifying (offset, limit) to retrieve a window of results. The total of offset+limit must not exceed 10000, or whatever is configured for index.max_result_window in the index settings.
When clients request Integer.MAX_VALUE as the limit, we should adapt that to fit elasticsearch's limit. For anything else that exceeds elasticsearch limits, we should reject the query.
Currently, we set it to 10000 when it is greater than 10000. That is boviously not sufficient