简体   繁体   中英

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.

In your initial scan search request, simply specify the size parameter with how many documents you'd like each scroll request to return, eg 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 (eg) 5 shards per index, simply use size: 20 , it'll do.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM