简体   繁体   English

ElasticSearch窗口滚动大小

[英]ElasticSearch Window Scroll Size

How do I increase the scroll size of my ES scroll search query? 如何增加ES滚动搜索查询的滚动大小? The default appears to be 50 hits, but I would like to increase that to 100 or so. 默认似乎是50次点击,但我想将其增加到100左右。 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: 在初始scan搜索请求中,只需指定size参数,以及每个滚动请求返回的文档数量,例如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. 另请注意,您将获得超过100个文档,因为size是每个分片,所以如果您真的只需要每批100个文档并且每个索引有(例如)5个分片,那么只需使用size: 20 ,它就会做。

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. 以后会更加整洁。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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