public QuerySearchResult executeScan(InternalSearchRequest request) throws ElasticSearchException {
SearchContext context = createContext(request);
assert context.searchType() == SearchType.SCAN;
context.searchType(SearchType.COUNT); // move to COUNT, and then, when scrolling, move to SCAN
activeContexts.put(context.id(), context);
assert context.searchType() == SearchType.COUNT;
try {
if (context.scroll() == null) {
throw new ElasticSearchException("Scroll must be provided when scanning...");
}
contextProcessing(context);