0

Using Elasticsearch 5.2, I stored around 20k Geo Points.

I want to query all of them to show them in a Google map. However, as specified in the documentation, the limit size seems to be 10k (I get the error Result window is too large, from + size must be less than or equal to: [10000] but was [20000].

Is there a workaround to get all my points ?

The query I used is :

{
    "size":10000,
    "_source": ["geo"],
    "query": {
        "bool": {
            "must" : [
                { "term" : { myId" : 1234 } },
                {
                    "range" :{
                        "@timestamp" : {
                            "gte" : "now-10m"
                        }
                    }
                }
            ]
        }
    }
}
Romain
  • 799
  • 1
  • 9
  • 29
  • did you try the [scroll and scan api](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html)? This will give you all the results, but not in a single query. – pratikvasa Feb 09 '17 at 13:55
  • I didn't know about this scroll api. I'll give a look, thanks ! – Romain Feb 09 '17 at 14:13

1 Answers1

0

To get a large result set you can use the scroll and scan api

It can be done in two steps.

First- To you search query add a scroll

POST /index_name/type_name/_search?scroll=1m
{
    "size": 100,
    "query": {
        "match_all": {}
    }
}

This will return a scroll id. Using the scroll id you can call the following repeatedly to get 100(size) results every time.

POST  /_search/scroll 
{
    "scroll" : "1m", 
    "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" 
}
pratikvasa
  • 1,897
  • 20
  • 24