API Requesting all documents in a certain range

Good afternoon!
How to correctly make a request to the elastic to get all the documents that fit the query for example: "query": { "bool": { "must": [ { "exists": { "field": "somefield" } } ], "filter": [ { "range": { "timestamp": { "gte": "2018-01-10 15:20:47.381" } } } ] } }, "_source": [ "somefield", "source" ] }
?

If I make a simple query, it prints out only with the default "size" value of 10, and how to do it to display all the values if you do not know the number of documents in advance?
Thanks.

If your goal is to export thousands of records you can use the scrolll API which is built for that.

Thank you for your advice!
It fits perfectly! Will be using helpers from elasticsearch-py module ))

To not create a new post - Ill ask again here... In what order to make a query in this situation: I want make a query by the presence of a certain field, but for a certain period, and then aggregate these data for example by source. Is this wright?"query": { "bool": { "must": [{"exists": {"field": "some_field"} } ], "filter": [{ "range": {timestamp": {"gte": "2018-01-10 15:20:47.381"}, "aggregations": {"the_name": {"terms": {"field": "source"}}}
Thank you!

I'd put also the exists in the filter part. So probably something like:

{
   "query":{
      "bool":{
         "filter":[
            {
               "exists":{
                  "field":"some_field"
               }
            },
            {
               "range":{
                  "timestamp":{
                     "gte":"2018-01-10 15:20:47.381"
                  }
               }
            }
         ]
      }
   },
   "aggregations":{
      "the_name":{
         "terms":{
            "field":"source"
         }
      }
   }
}

Thank you very much!!!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.