use of org.elasticsearch.action.search.SearchScrollRequestBuilder in project wonderdog by infochimps-labs.
the class ElasticSearchStreamingRecordReader method fetchNextHits.
private void fetchNextHits() {
if (scrollId == null) {
LOG.info("Running initial scroll with timeout " + scrollTimeout);
SearchRequestBuilder request = split.initialScrollRequest(client, scroll, requestSize);
SearchResponse response = request.execute().actionGet();
this.scrollId = response.getScrollId();
LOG.info("Got scroll ID " + scrollId);
// Do we need to call fetchNextHits() again here? Or does
// the initial request also itself contain the first set
// of hits for the scroll?
//
// fetchNextHits();
} else {
// LOG.info("Running query for scroll ID "+scrollId+" with timeout "+scrollTimeout);
SearchScrollRequestBuilder request = split.scrollRequest(client, scroll, scrollId);
SearchResponse response = request.execute().actionGet();
this.scrollId = response.getScrollId();
// LOG.info("Got scroll ID "+scrollId);
this.hitsItr = response.getHits().iterator();
}
}
Aggregations