I tried to use the example in here: https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-search-scrolling.html
on how to use scroll with java in elasticsearch. this is the code:
QueryBuilder qb = termQuery("multi", "test");
SearchResponse scrollResp = client.prepareSearch("test")
.addSort(FieldSortBuilder.DOC_FIELD_NAME, SortOrder.ASC)
.setScroll(new TimeValue(60000))
.setQuery(qb)
.setSize(100).get(); //max of 100 hits will be returned for each scroll
//Scroll until no hits are returned
do {
for (SearchHit hit : scrollResp.getHits().getHits()) {
//Handle the hit...
}
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.
though for some reasons I have an error which says The method prepareSearch(String) is undefined for the type RestHighLevelClient.
my client variable is indeed RestHighLevelClient but in the tutorial it is what it should be.
ant ideas what is the problem?