'How does pagination works in elastic search?

I am currently using elastic search python client for search the index of my elastic search.

Let's say I have 20 million documents, and I am using the pagination with from and size parameters. I have read in the documentation that there is a limit of 10k. But I didn't understand what that limit mean.

For example,

  1. Did that limit mean I can only use pagination (i.e. from and size) calls 10000 times? like from=0, size =10, from=10, size =10 etc., 10000 times.

  2. Or Do they mean I can make unlimited pagination calls using the from and size params but there is a size limit of 10k per each pagination call?

Can someone clarify this?



Solution 1:[1]

The limit is called max_result_window and default value is 10k. Mathematically this is the max value size+from can take.

from:1, size:10000 will give error.

from:5, size:9996 will give error.

from:9999, size:2 will give error.

Search after is the recommended alternative if you want deeper results.

Solution 2:[2]

You can update existing index settings with this query:

PUT myexistingindex/_settings
{
  "settings": {
    "max_result_window": 20000000
  }
}

If your are creating dynamic index, you can give max result window parameter in settings.

In Java like this:

private void createIndex(String indexName) throws IOException {
    Settings settings = Settings.builder()
            .put("number_of_shards", 1)
            .put("number_of_replicas", 0)
            .put("index.translog.durability", "async")
            .put("index.translog.sync_interval", "5s")
            .put("max_result_window", "20000000").build();
    
    CreateIndexRequest createIndexRequest = new CreateIndexRequest(indexName).settings(settings);
    restHighLevelClient.indices().create(createIndexRequest, RequestOptions.DEFAULT);
}

After these configurations, you can give "from" parameters up to 20 million.

But this way is not recommended.

You can review this document: Scroll Api

Solution 3:[3]

::-webkit-input-placeholder doesn't apply to every browser
use ::placeholder

.class::placeholder{
    color: red;
}

Solution 4:[4]

It seems ::-webkit-input-placeholder is not the correct way to do it.

You should use it like this:

::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
  color: red;
  opacity: 1; /* Firefox */
}

:-ms-input-placeholder { /* Internet Explorer 10-11 */
  color: red;
}

::-ms-input-placeholder { /* Microsoft Edge */
  color: red;
}

Read more here: w3schools

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tushar Shahi
Solution 2 Bilal Demir
Solution 3 Anuja Nimesh
Solution 4