Issue with NoNodeAvailableException[None of the configured nodes are available:


I am developing my first Java client to access ES but got the NoNodeAvailableException[None of the configured nodes are available: error when try it and the issue is driving me crazy.

What I am doing is:

Settings settings = Settings.settingsBuilder()
.put("", "mycluster")
.put("client.transport.ping_timeout", "30s")

    Client client = null;
    try {
        client = TransportClient.builder().settings(settings)
                .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("myservername"), 9300));   // INT

        IndexRequestBuilder prepareIndex = client.prepareIndex("*", "log");

        ListenableActionFuture<IndexResponse> execute = prepareIndex.execute(); 

    } catch (UnknownHostException e) {
    } catch (Exception e) {

I have tried to increase the timeout even to 30 seconds but no success.
I saw on the net that a lot of people have had this problem but got no solution valid for me.

Thanks in advance.

PD: I actually used proper values on mycluster and myservername so this is not the error source.

Please format your code using </> icon. It will make your post more readable.

Common mistakes:

  • Forgot to define on the machine
  • changed
  • Firewall issues with port 9300


1 Like


Thanks for your reply.

I am sure that remains unchanged.
What do you mean with Is it a property that I should add on my java code?

BTW: is there any special property that should I set on server to allow my java client that is placed out of the Elasticsearch server could get connected? Any property that should I check?

Thanks in advance.

I meant this:

Must be added on your nodes if you want them to be reachable from outside your server.

No. If you want to secure the transport layer, you need to use Shield / X-Pack (commercial subscription).

Note that in the next future, a REST java client will be released within 5.0. You can use it with elasticsearch 2.x as well.
Then you could add a NGinx layer to secure it. Still I think it would be much easier and with many other features OOTB to use X-Pack.


Seems that my problem is that I am trying to access the Amazon service instead of a real Elasticsearch running on an EC2 instance.

I was unable to find other way to access such service than the Kibana console.....

Oh? You are using Amazon Elasticsearch service?
AFAIK you can't do it with the transport client. Not sure they changed that.

Did you look at by any chance?
It works with TransportClient and security OOTB.

Disclaimer: I work at elastic.


Well, my advise was to use ELK but somebody else decided to use the AWS Elasticsearch service... :slight_smile:

However, I wonder if it is possible to consume data from the Elasticsearch REST service from a Java application. I mean: is there a way to make specific queries to such service? Guide? Examples?

Thanks in advance.

You can wait for the Java REST client to be released.
There are already some alpha versions but not ready for production.
It's a low level client though.

Also JEST: could help you.

Thank you!