ElasticsearchScrollRequest implements ElasticsearchRequest { public SearchRequest searchRequest() { return new SearchRequest() .indices(indexName) .scroll(DEFAULT_SCROLL_TIMEOUT) .source(sourceBuilder); }  @Override ElasticsearchResponse search(Function<SearchRequest, SearchResponse> searchAction,
                                      Function<SearchScrollRequest, SearchResponse> scrollAction); @Override void clean(Consumer<String> cleanAction); SearchRequest searchRequest(); boolean isScrollStarted(); SearchScrollRequest scrollRequest(); void reset(); static final TimeValue DEFAULT_SCROLL_TIMEOUT; }
@Test void searchRequest() { request.getSourceBuilder().query(QueryBuilders.termQuery("name", "John")); assertEquals( new SearchRequest() .indices("test") .scroll(ElasticsearchScrollRequest.DEFAULT_SCROLL_TIMEOUT) .source(new SearchSourceBuilder().query(QueryBuilders.termQuery("name", "John"))), request.searchRequest()); }