reactivesearch icon indicating copy to clipboard operation
reactivesearch copied to clipboard

Get more than 10000 results when using pagination

Open malsioufi opened this issue 6 years ago • 4 comments

Affected Projects React

Library Version: ^3.12.7

Describe the bug I am using ReactiveList component to show the results of my search. I am only getting up to 10000 results when I use pagination. So, for example if I set the size prop to 1000 and I go to page 10 the "next" button gets disabled even though I know that there are more results to be shown.

To Reproduce

Steps to reproduce the behavior:

  • Generate data more than 10000
  • Use ReactiveList component with pagination=true, size=1000
  • Go to page 10
  • Next button will be disabled so no more results can be requested.

Expected behavior

  • Be able to see more than 10 pages as I have more than 10000 documents.

Screenshots

image

Desktop (please complete the following information):

  • OS: Windos 10
  • Browser Google Chrome
  • Version 86.0.4240.198

malsioufi avatar Nov 20 '20 16:11 malsioufi

You have to set the track_total_hits property in ReactiveList. For example,

<ReactiveList
    defaultQuery={() => ({ track_total_hits: true })}
/>

bietkul avatar Nov 20 '20 16:11 bietkul

Thanks @bietkul but when I tried this I got the following exception in the log of the browser.

{
  "took": 0,
  "responses": [
    {
      "error": {
        "root_cause": [
          {
            "type": "illegal_argument_exception",
            "reason": "Result window is too large, from + size must be less than or equal to: [10000] but was [11000]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."
          }
        ],
        "type": "search_phase_execution_exception",
        "reason": "all shards failed",
        "phase": "query",
        "grouped": true,
        "failed_shards": [
          {
            "shard": 0,
            "index": "markings_finder",
            "node": "D7pf3-O-TT6CNzaIg1X11w",
            "reason": {
              "type": "illegal_argument_exception",
              "reason": "Result window is too large, from + size must be less than or equal to: [10000] but was [11000]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."
            }
          }
        ],
        "caused_by": {
          "type": "illegal_argument_exception",
          "reason": "Result window is too large, from + size must be less than or equal to: [10000] but was [11000]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.",
          "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "Result window is too large, from + size must be less than or equal to: [10000] but was [11000]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."
          }
        }
      },
      "status": 400
    }
  ]
}

malsioufi avatar Nov 20 '20 16:11 malsioufi

Can you share the request body? Are you using page size as 1000?

bietkul avatar Nov 20 '20 17:11 bietkul

It turned out to be an elasticsearch thingy. I had to update my index settings in order to avoid this error. As it says in this question on Stackoverflow https://stackoverflow.com/questions/41677198/result-window-is-too-large-from-size-must-be-less-than-or-equal-to-10000-b/41677310

But thank you for mentioning defaultQuery={() => ({ track_total_hits: true })} It solves my issue but it is not mentioned anywhere in the documentation. I think it'd be good to be mentioned somewhere.

malsioufi avatar Nov 20 '20 17:11 malsioufi