node = nb.node();
client = node.client();
Logger.info("ElasticSearch : Started in Local Mode");
} else {
Logger.info("ElasticSearch : Starting in Client Mode");
TransportClient c = new TransportClient(settings);
if (config.client == null) {
throw new Exception("Configuration required - elasticsearch.client when local model is disabled!");
}
String[] hosts = config.client.trim().split(",");
boolean done = false;
for (String host : hosts) {
String[] parts = host.split(":");
if (parts.length != 2) {
throw new Exception("Invalid Host: " + host);
}
Logger.info("ElasticSearch : Client - Host: " + parts[0] + " Port: " + parts[1]);
c.addTransportAddress(new InetSocketTransportAddress(parts[0], Integer.valueOf(parts[1])));
done = true;
}
if (!done) {
throw new Exception("No Hosts Provided for ElasticSearch!");
}