}
@Test public void testScan() throws Exception {
Scroll scroll = new Scroll(TimeValue.timeValueMillis(500));
QuerySearchResult scanResult = searchService.executeScan(searchRequest(searchSource().query(matchAllQuery()).size(2), SearchType.SCAN).scroll(scroll));
assertThat(scanResult.queryResult().topDocs().totalHits, equalTo(5));
Set<String> idsLoaded = Sets.newHashSet();
// start scrolling
FetchSearchResult fetchResult = searchService.executeScan(new InternalScrollSearchRequest(scanResult.id()).scroll(scroll)).result().fetchResult();
assertThat(fetchResult.hits().hits().length, equalTo(2));