Elasticsearch pagination and limit max number of pages
Note that from + size can not be more than the index.max_result_window index setting which defaults to 10,000. See the Scroll or Search After API for more efficient ways to do deep scrolling.
Source: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-from-size.html