Hi:
I am trying to run an integration test of an application that connects to ES Cluster via either Node or Transport Client. However, I am running into some issues when connecting to the embedded ES instance.
This is what I have done:
I start up an embedded ES instance with the following settings :
Settings elasticSearchSettings = Settings.settingsBuilder()
.put("cluster.name","ES-INTEGRATION-TEST")
.put("transport.tcp.port","9300")
.put("http.enabled", true)
.put("path.data", dataDirectory)
.put("path.home","/Volumes/3TBDrive/data/sdp/es_211_logs").build();
then I create a Client in another thread of the application like so :
Settings settings = Settings.settingsBuilder().put("cluster.name", getESClusterName()).build();
esClient = TransportClient.builder().settings(settings).build();
((TransportClient)esClient).addTransportAddresses(new InetSocketTransportAddress(
InetAddress.getByName(host), getESPort()));
where getESPost and getESClusterName return 9300 and "ES-INTEGRATION-TEST" respectively.
However, when I execute the following command after creating the Transport Client :
esClient.admin().indices().prepareExists(index).execute().actionGet().isExists();
where index is the variable containing the index name, I get the error :
NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{127.0.0.1}{localhost/127.0.0.1:9300}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:207)
at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55)
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:283)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:347)
at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1183)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:85)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:59)
I am running ES 2.1.1 with Java 8 JVM
any help is appreciated
After thought :
If I except the same command by
embeddedElasticServer.getClient.admin().cluster().prepareState().execute().actionGet().getState.prettyPrint()
It works just fine.
Thanks much
Ramdev