TransportClient client = new TransportClient();
for (String esLocation : esLocations) {
String[] locationSocket = esLocation.split(":");
String host = locationSocket[0];
String port = locationSocket.length > 1 ? locationSocket[1] : "9300";
client.addTransportAddress(new InetSocketTransportAddress(host, Integer.parseInt(port)));
}
LOGGER.info("index %s exists?", indexName);
IndicesExistsRequest existsRequest = client.admin().indices().prepareExists(indexName).request();
if (client.admin().indices().exists(existsRequest).actionGet().isExists()) {
LOGGER.info("index %s exists... deleting!", indexName);