// load the _source and extract it from it. This functionality has been replaced by the source filtering
// parameter." -- So we should look at the source filtering parameter once we switched to ES 1.x.
srb.addFields(fields.toArray(new String[fields.size()]));
srb.addField("_source"); // always request the _source field because otherwise we can't access non-stored values
final SearchRequest request = srb.setSearchType(SearchType.SCAN)
.setScroll(new TimeValue(1, TimeUnit.MINUTES))
.setSize(500).request(); // TODO magic numbers
if (LOG.isDebugEnabled()) {
try {
LOG.debug("ElasticSearch scroll query: {}", XContentHelper.convertToJson(request.source(), false));
} catch (IOException ignored) {
}
}
final SearchResponse r = c.search(request).actionGet();
return new ScrollResult(c, query, request.source(), r, fields);
}