AntonShuvaev / elasticsearch4idea

Elasticsearch Plugin for JetBrains IDEs
https://plugins.jetbrains.com/plugin/14512-elasticsearch
59 stars 8 forks source link

Cannot browse past 10000th document #53

Closed ostrolucky closed 2 years ago

ostrolucky commented 2 years ago

Related to https://github.com/AntonShuvaev/elasticsearch4idea/issues/49:

Originally, I demonstrated the case where I changed page size. However, looks like issue is there even with default page size, which is 10 results, once I go above result 10000. 2021-11-03_19-09-12 (1)

AntonShuvaev commented 2 years ago

Thanks for the feature request.

The max result (10000) is limited by index.max_result_window. As a workaround, it can be increased but this can affect the performance. Also, a workaround is to use search_after manually adding to your request:

  "sort": [
    {
      "_doc": {
        "order": "asc"
      }
    }
  ],
  "search_after": [
    9999
  ]

Of course, it is not very convenient to do it manually. I will consider adding search_after automatically when the result is bigger than index.max_result_window. But this also has some disadvantages: in a common case, we don't know how many documents were before so we can't show the page number and we can go only forward.

Usually, it is not necessary to get more than 10000 documents since you can specify filters and reduce the result. Could you describe your use case in more detail?