@Test void cleanup() { ClearScrollRequestBuilder requestBuilder = mock(ClearScrollRequestBuilder.class); when(nodeClient.prepareClearScroll()).thenReturn(requestBuilder); when(requestBuilder.addScrollId(any())).thenReturn(requestBuilder); when(requestBuilder.get()).thenReturn(null); ElasticsearchNodeClient client = new ElasticsearchNodeClient(mock(ClusterService.class), nodeClient); ElasticsearchScrollRequest request = new ElasticsearchScrollRequest("test", factory); request.setScrollId("scroll123"); client.cleanup(request); assertFalse(request.isScrollStarted()); InOrder inOrder = Mockito.inOrder(nodeClient, requestBuilder); inOrder.verify(nodeClient).prepareClearScroll(); inOrder.verify(requestBuilder).addScrollId("scroll123"); inOrder.verify(requestBuilder).get(); }
@Override public void cleanup(ElasticsearchRequest request) { request.clean(scrollId -> client.prepareClearScroll().addScrollId(scrollId).get()); }
ElasticsearchNodeClient implements ElasticsearchClient { @Override public void cleanup(ElasticsearchRequest request) { request.clean(scrollId -> client.prepareClearScroll().addScrollId(scrollId).get()); } }
ElasticsearchNodeClient implements ElasticsearchClient { @Override public void cleanup(ElasticsearchRequest request) { request.clean(scrollId -> client.prepareClearScroll().addScrollId(scrollId).get()); }  }
ElasticsearchNodeClient implements ElasticsearchClient { @Override public void cleanup(ElasticsearchRequest request) { request.clean(scrollId -> client.prepareClearScroll().addScrollId(scrollId).get()); }  @Override Map<String, IndexMapping> getIndexMappings(String indexExpression); @Override ElasticsearchResponse search(ElasticsearchRequest request); @Override void cleanup(ElasticsearchRequest request); @Override void schedule(Runnable task); }
ElasticsearchNodeClient implements ElasticsearchClient { @Override public void cleanup(ElasticsearchRequest request) { request.clean(scrollId -> client.prepareClearScroll().addScrollId(scrollId).get()); }  @Override Map<String, IndexMapping> getIndexMappings(String indexExpression); @Override ElasticsearchResponse search(ElasticsearchRequest request); @Override void cleanup(ElasticsearchRequest request); @Override void schedule(Runnable task); static final String[] ALL_TYPES; static final Function<String, Predicate<String>> ALL_FIELDS; }