@SuppressWarnings({ "unchecked", "rawtypes" }) private void fetch() throws StorageException { try { Builder builder = new SearchScroll.Builder(scrollId, "1m"); SearchScroll scroll = new SearchScroll(builder) { @Override public JestResult createNewElasticSearchResult(String responseBody, int statusCode, String reasonPhrase, Gson gson) { return createNewElasticSearchResult(new SearchResult(gson), responseBody, statusCode, reasonPhrase, gson); } }; SearchResult response = (SearchResult) esClient.execute(scroll); if (!response.isSucceeded()) { throw new StorageException("Scrolled fetch failed " + response.getErrorMessage()); } this.hits = (List) response.getHits(Map.class); } catch (IOException e) { throw new StorageException(e); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) private void fetch() throws StorageException { try { Builder builder = new SearchScroll.Builder(scrollId, "1m"); SearchScroll scroll = new SearchScroll(builder) { @Override public JestResult createNewElasticSearchResult(String responseBody, int statusCode, String reasonPhrase, Gson gson) { return createNewElasticSearchResult(new SearchResult(gson), responseBody, statusCode, reasonPhrase, gson); } }; SearchResult response = (SearchResult) esClient.execute(scroll); if (!response.isSucceeded()) { throw new StorageException("Scrolled fetch failed " + response.getErrorMessage()); } this.hits = (List) response.getHits(Map.class); } catch (IOException e) { throw new StorageException(e); } }
private void initScroll() throws StorageException { try { Search search = new Search.Builder(query) .addIndex(getIndexName()) .addType(entityType) .setParameter(Parameters.SCROLL, "1m") .addSort(sort) .build(); SearchResult response = esClient.execute(search); if (!response.isSucceeded()) { throw new StorageException("Scrolled query failed " + response.getErrorMessage()); } scrollId = response.getJsonObject().get("_scroll_id").getAsString(); this.hits = (List) response.getHits(Map.class); } catch (IOException e) { throw new StorageException(e); } }
private void initScroll() throws StorageException { try { Search search = new Search.Builder(query) .addIndex(getIndexName()) .addType(entityType) .setParameter(Parameters.SCROLL, "1m") .addSort(sort) .build(); SearchResult response = esClient.execute(search); if (!response.isSucceeded()) { throw new StorageException("Scrolled query failed " + response.getErrorMessage()); } scrollId = response.getJsonObject().get("_scroll_id").getAsString(); this.hits = (List) response.getHits(Map.class); } catch (IOException e) { throw new StorageException(e); } }
final SearchResult scrollResponse = client.execute(initialScroll); if (!scrollResponse.isSucceeded()) { throw new IllegalStateException(scrollResponse.getErrorMessage());
SearchResult response = getClient().execute(search); if (!response.isSucceeded()) { throw new RuntimeException(response.getErrorMessage());
SearchResult response = getClient().execute(search); if (!response.isSucceeded()) { throw new RuntimeException(response.getErrorMessage());