mark
mark

Reputation: 2063

ElasticSearch Window Scroll Size

How do I increase the scroll size of my ES scroll search query? The default appears to be 50 hits, but I would like to increase that to 100 or so. I cannot find a reference to adjusting the scroll window size in the documentation.

Upvotes: 5

Views: 11101

Answers (2)

Shawn Sim
Shawn Sim

Reputation: 555

POST /your_index/_search?search_type=scan
{    
    "scroll:" "1M"
    "query": { "match_all": {}},
    "size":  100    
}

This should also work. Putting the scroll into the braces. Will be neater for reading later.

Upvotes: 0

Val
Val

Reputation: 217554

In your initial scan search request, simply specify the size parameter with how many documents you'd like each scroll request to return, e.g. 100:

POST /your_index/_search?search_type=scan&scroll=1m 
{
    "query": { "match_all": {}},
    "size":  100
}

or more simply

GET /your_index/_search?search_type=scan&scroll=1m&size=100

Also note that you will get more than 100 documents back, because the size is per-shard, so if you really want only 100 docs per batch and your have (e.g.) 5 shards per index, simply use size: 20, it'll do.

Upvotes: 12

Related Questions