elasticsearchr icon indicating copy to clipboard operation
elasticsearchr copied to clipboard

Handling more than 10k result

Open eppofahmi opened this issue 6 years ago • 3 comments
trafficstars

how to get more than 10 k result. Is there scroll function here... thanks

eppofahmi avatar Oct 11 '19 11:10 eppofahmi

You're gonna have to provide more information than that 😃

AlexIoannides avatar Oct 13 '19 20:10 AlexIoannides

I mean, how I can get result more than 10k, since basic elastic search limited to 10k. Here is my query that I am trying to use.

team_name = "A Team Name"
fisrt_date = "2019-01-01"
last_date = "2019-01-31"
el_query <- elasticsearchr::query(
      paste0(
        '{
        "bool": {
          "must": [
            {
              "query_string": {
                "default_field": "team",
                "query": "',team_name,'"
              }
            },
            {
              "match": {
                "katakunci": "',keywords,'"
              }
            },
            {
              "range": {
                "tanggal": {
                  "gt": "',first_date,'",
                  "lt": "',last_date,'"
                }
              }
            }
            ]
        }
      }'
      ), size = 20000
    )'
records <- elasticsearchr::elastic(cluster_url = url, index = "index_name",
                                            doc_type = "_doc") %search% el_query

That would give me an error, because as far as I know, size parameter limited to only 10000. But I want lets say in my case size = 20000. I know that in elastic there is scroll api that possible to get more than 10K result. My question is in elasticsearchr there are any function to get more than 10k result.

Thankyou Alex.

eppofahmi avatar Oct 14 '19 00:10 eppofahmi

up for this

salvob41 avatar Apr 06 '20 15:04 salvob41