@Test(expected = IOException.class) public void indexExistsThrowsException_forServerFailure() throws Exception { mockServerClient.when(request().withPath("/" + INDEX_NAME)) .error(HttpError.error().withDropConnection(true)); connector.indexExists(INDEX_NAME); }
@Override public boolean indexExists(String index) throws IOException { Response response = client.getLowLevelClient().performRequest(new Request(HttpHead.METHOD_NAME, "/" + index)); return response.getStatusLine().getStatusCode() == HttpStatus.SC_OK; }
MappingTypeElasticsearchConnector implements ElasticsearchConnector { @Override public boolean indexExists(String index) throws IOException { Response response = client.getLowLevelClient().performRequest(new Request(HttpHead.METHOD_NAME, "/" + index)); return response.getStatusLine().getStatusCode() == HttpStatus.SC_OK; } }
MappingTypeElasticsearchConnector implements ElasticsearchConnector { @Override public boolean indexExists(String index) throws IOException { Response response = client.getLowLevelClient().performRequest(new Request(HttpHead.METHOD_NAME, "/" + index)); return response.getStatusLine().getStatusCode() == HttpStatus.SC_OK; } MappingTypeElasticsearchConnector(RestHighLevelClient client); }
MappingTypeElasticsearchConnector implements ElasticsearchConnector { @Override public boolean indexExists(String index) throws IOException { Response response = client.getLowLevelClient().performRequest(new Request(HttpHead.METHOD_NAME, "/" + index)); return response.getStatusLine().getStatusCode() == HttpStatus.SC_OK; } MappingTypeElasticsearchConnector(RestHighLevelClient client); @Override boolean isAvailable(); @Override boolean indexExists(String index); @Override boolean createIndex(String index); @Override void storeItems(String index, Collection<QueryVersionReport> reports); @Override void close(); }
MappingTypeElasticsearchConnector implements ElasticsearchConnector { @Override public boolean indexExists(String index) throws IOException { Response response = client.getLowLevelClient().performRequest(new Request(HttpHead.METHOD_NAME, "/" + index)); return response.getStatusLine().getStatusCode() == HttpStatus.SC_OK; } MappingTypeElasticsearchConnector(RestHighLevelClient client); @Override boolean isAvailable(); @Override boolean indexExists(String index); @Override boolean createIndex(String index); @Override void storeItems(String index, Collection<QueryVersionReport> reports); @Override void close();  }