Hi
I'm trying to set up a test case where the setUp of the test case sets up
both a Node Client and then talks to the Node Client through the Transport
Client. There is something that I'm missing as the Transport Client can
easily communicate with another cluster, but not the one in set up within
the test case. Keep getting the
"org.elasticsearch.client.transport.NoNodeAvailableException: No node
available"-exception.
My NodeClient is created like this:
protected void init() throws UnknownHostException {
String hostName = java.net.InetAddress.getLocalHost().getHostName();
Builder settingsBuilder = ImmutableSettings.settingsBuilder();
Settings settings = settingsBuilder.build();
nodebuilder = nodeBuilder();
nodebuilder.client(false);
nodebuilder.local(true);
nodebuilder.clusterName(hostName);
nodebuilder.settings(settings);
Node node = nodebuilder.node();
client = node.client();
My TransportClient is created like this (where cluster and host gets the
hostName as above):
Settings settings =
ImmutableSettings.settingsBuilder().put("cluster.name", cluster).build();
client = new TransportClient(settings).addTransportAddress(new
InetSocketTransportAddress(host, port));
When I execute this I get an exception:
boolean indexExists =
client.admin().indices().prepareExists(index).execute().actionGet().exists();
Anybody got any ideas?
And this is the exception:
org.elasticsearch.client.transport.NoNodeAvailableException: No node
available
at
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:202)
at
org.elasticsearch.client.transport.support.InternalTransportIndicesAdminClient.execute(InternalTransportIndicesAdminClient.java:85)
at
org.elasticsearch.client.support.AbstractIndicesAdminClient.exists(AbstractIndicesAdminClient.java:140)
at
org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder.doExecute(IndicesExistsRequestBuilder.java:43)
at
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:62)
at
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:57)
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.