public boolean indexExists ( String name ) throws IOException { CloseableHttpClient client = HttpClients . createDefault ( ) ; HttpHead head = new HttpHead ( String . format ( "http://%s:%d/%s" , host , port , name ) ) ; try { CloseableHttpResponse response = client . execute ( head ) ; return response . getStatusLine ( ) . getStatusCode ( ) == HttpStatus . SC_OK ; } finally { head . releaseConnection ( ) ; } }
Tests for the index existence with specified name .