mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 17:34:17 -04:00
Documentation updates for scroll API size parameter (#21229)
* Document size parameter for scroll API * Fix size parameter behavior description for scroll
This commit is contained in:
parent
8dd91eb2d6
commit
1f1daf59bc
2 changed files with 6 additions and 7 deletions
|
@ -58,7 +58,7 @@ SearchResponse scrollResp = client.prepareSearch(test)
|
|||
.addSort(FieldSortBuilder.DOC_FIELD_NAME, SortOrder.ASC)
|
||||
.setScroll(new TimeValue(60000))
|
||||
.setQuery(qb)
|
||||
.setSize(100).execute().actionGet(); //100 hits per shard will be returned for each scroll
|
||||
.setSize(100).execute().actionGet(); //max of 100 hits will be returned for each scroll
|
||||
//Scroll until no hits are returned
|
||||
do {
|
||||
for (SearchHit hit : scrollResp.getHits().getHits()) {
|
||||
|
@ -68,10 +68,6 @@ do {
|
|||
scrollResp = client.prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(60000)).execute().actionGet();
|
||||
} while(scrollResp.getHits().getHits().length != 0); // Zero hits mark the end of the scroll and the while loop.
|
||||
--------------------------------------------------
|
||||
[NOTE]
|
||||
====
|
||||
The size-parameter is per shard, so if you run a query against multiple indices (leading to many shards being involved in the query) the result might be more documents per execution of the scroll than you would expect!
|
||||
====
|
||||
|
||||
[[java-search-msearch]]
|
||||
=== MultiSearch API
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue