Docs: Some Data Cant't be obtained.

In previous case, the first 100 data can't be obtained.

Closes #8103
This commit is contained in:
wmx3ng 2014-10-16 11:35:52 +08:00 committed by Clinton Gormley
parent 0fb81d6643
commit 940534299d

View File

@ -62,10 +62,11 @@ SearchResponse scrollResp = client.prepareSearch(test)
.setSize(100).execute().actionGet(); //100 hits per shard will be returned for each scroll
//Scroll until no hits are returned
while (true) {
scrollResp = client.prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(600000)).execute().actionGet();
for (SearchHit hit : scrollResp.getHits()) {
//Handle the hit...
}
scrollResp = client.prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(600000)).execute().actionGet();
//Break condition: No hits are returned
if (scrollResp.getHits().getHits().length == 0) {
break;