Hi,
I am trying to use Java Client to connect to my elastic.co cloud instance. Here is my code, I am getting NoNodeAvailableException. Let me know if I am missing some thing. Appreciate any help.
Code:
try {
// Elastic Endpoint: https://3bc1590ea5e7ea7fcb7adc416f951b59.us-east-1.aws.found.io:9243
String clusterName= "autospecs-drawings-dev";
String esHost = "3bc1590ea5e7ea7fcb7adc416f951b59.us-east-1.aws.found.io";
int esPort = 9243;
this.transportAddress = new InetSocketTransportAddress(InetAddress.getByName(esHost), esPort);
Settings settings = Settings.builder()
.put("cluster.name", clusterName).
put("logger.org.elasticsearch.transport.TransportService.tracer", "TRACE").
build();
this.client = new PreBuiltTransportClient(settings).addTransportAddress(transportAddress);
SearchResponse sr = client.prepareSearch("autospecs-drawings-0").get();
long numHits = sr.getHits().getTotalHits();
System.out.println("Number of hits is " + numHits);
} catch (Exception e) {
//e.printStackTrace();
// TODO Auto-generated catch block
esLogger.error("Exception during getting transportAddress", e);
}
Exception is this.
15:55:13.640 [main] ERROR - Exception during getting transportAddress
org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{1NmEyI9ySICMCg-AuluqMA}{3bc1590ea5e7ea7fcb7adc416f951b59.us-east-1.aws.found.io}{54.197.250.163:9243}]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:347) ~[elasticsearch-5.5.0.jar:5.5.0]
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:245) ~[elasticsearch-5.5.0.jar:5.5.0]
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59) ~[elasticsearch-5.5.0.jar:5.5.0]
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:363) ~[elasticsearch-5.5.0.jar:5.5.0]
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:408) ~[elasticsearch-5.5.0.jar:5.5.0]
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80) ~[elasticsearch-5.5.0.jar:5.5.0]
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54) ~[elasticsearch-5.5.0.jar:5.5.0]
at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:62) ~[elasticsearch-5.5.0.jar:5.5.0]
at com.pype.autospecs.util.ESUtil.(ESUtil.java:61) [bin/:?]
at com.pype.autospecs.util.ESUtil.(ESUtil.java:28) [bin/:?]