I have seen lot of topics in here with same title... but i couldnot get a proper solution. So am asking again.
I am getting a NoNodeException msg which is given below..
Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{wGBsSw61TMm99QgcPcogLw}{10.242.244.170}{10.242.244.170:9300}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:328)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:226)
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:345)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:403)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54)
at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:62)
at elk.GETCallOnELK.callingELKWithGetMethod(GETCallOnELK.java:16)
at elk.ELKStackAPICallMain.main(ELKStackAPICallMain.java:9)
my code is
public class TransportClientConnection {
public TransportClient callingElasticsearchAPI() throws ELKException {
TransportClient client = null;
try {
client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(
InetAddress.getByName("10.242.244.170"), 9300));
} catch (UnknownHostException e) {
throw new ELKException(e);
}
return client;
}
}
public class GETCallOnELK {
public void callingELKWithGetMethod() throws ELKException {
TransportClientConnection creatingELKObjectForMethodCall = new TransportClientConnection();
TransportClient clientForGET = creatingELKObjectForMethodCall
.callingElasticsearchAPI();
GetResponse response = clientForGET.prepareGet("logstash-2016.11.29",
"EventLog", "AVivTmHdyF6Gdb7rRxGV").get();
String indexName = response.getIndex();
System.out.println("The Name of the index is :" + indexName);
}
}
and a main to call these methods for a connection..
What possibly could cause this exception as I have no place in the API to mention the nodes or something.. I have a default cluster which is 'elasticsearch' and i have a single node..
Please help me solve this issue.