Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 286
mark Avatar asked Dec 19 '22 22:12

mark


1 Answers

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.

like image 169
Val Avatar answered Jan 06 '23 12:01

Val