I am writing a simple Java wrapper around ElasticSearch\'s admin client. To test it I have a main method that first checks if an index exists (IndicesExistsRequest), if so delet
Here is my solution when using RestHighLevelClient client;
Here a code-snippet: :
public boolean checkIfIndexExists(String indexName) throws IOException {
Response response = client.getLowLevelClient().performRequest("HEAD", "/" + indexName);
int statusCode = response.getStatusLine().getStatusCode();
return (statusCode != 404);
}
A contribution for someone else !