NoNodeAvailableException - Java API

After connecting to the elasticsearch cluster through the Java API

2015-11-11 11:04:36.987 Getting ES Client...
Nov 11, 2015 11:04:37 AM org.elasticsearch.plugins.PluginsService
INFO: [Elfqueen] loaded [], sites []
2015-11-11 11:04:36.987 Node:
2015-11-11 11:04:36.987 ES Client obtained

I'm not able to create a new mapping in the cluster because I get this error on the last line of this piece of code:

CreateIndexRequestBuilder createIndexRequestBuilder = client.admin().indices().prepareCreate(indexName);
createIndexRequestBuilder.addMapping(documentName, json);

Exception in thread "Thread-1" NoNodeAvailableException[None of the configured nodes are available: []]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(
at org.elasticsearch.client.transport.TransportClientNodesService.execute(
at org.elasticsearch.client.transport.TransportClient.doExecute(
at org.elasticsearch.action.ActionRequestBuilder.execute(
at org.elasticsearch.action.ActionRequestBuilder.execute(

Is the same code that I used with previous versions of the Java API but I didn't get any errors then. I get the ES client with this code:

private static Client getClient() {  
        Settings settings = Settings.settingsBuilder().build();
        Client client = null;
        TransportClient transportClient = TransportClient.builder().settings(settings).build();

        try {
            client = transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(Receptor.es_ip), 9300));
        } catch (UnknownHostException e) {
            System.err.println(Util.getTimestampStr() + "UnknownHostException error.");

        if(transportClient.connectedNodes() == null){
            System.err.println(Util.getTimestampStr() + "No connected nodes found.");
            for(DiscoveryNode d : transportClient.connectedNodes()){
                System.err.println(Util.getTimestampStr() + "DiscoveryNode: " + d.getHostName());
            for(DiscoveryNode d : transportClient.listedNodes()){
                System.err.println(Util.getTimestampStr() + "Node: " + d.getHostName());
        return transportClient;

You use empty settings for TransportClient, but you should declare at least the you want to connect to, if your cluster name is not elasticsearch.

It doesn't matter, I get the same error, I added the cluster line to the getClient() method and I get the error anyway.

Settings settings = Settings.settingsBuilder().put("", Receptor.clusterName).build();
Client client = null;
TransportClient transportClient = TransportClient.builder().settings(settings).build();

I keep getting the same error. This happen to me since I use elasticsearch 2 and the correspondent Java API for ES 2.


I am trying for Nutch 2.3 + ES 2.0 integration. I am not able to index the data fetched from the nutch. I am also facing the same exception.

java.lang.Exception: org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []

My nutch-site.xml conf : Default class for storing data Crawler plugin.includes protocol-(http|httpclient)|urlfilter-regex|index-(basic|more)|query-(basic|site|url|lang)|indexer-elastic|nutch-extensionpoints|parse-(text|html|msexcel|msword|mspowerpoint|pdf)|summary-basic|scoring-opic|urlnormalizer-(pass|regex|basic)|parse-(html|tika|metatags)|index-(basic|anchor|more|metadata) 192.168.2.a elastic.cluster uips_cluster elastic.index nutch parser.character.encoding.default utf-8 http.content.limit 6553600

I have set up ES 2.0 cluster as 1 master 2 nodes with master at 192.168.2.a

Can anyone help me how to resolve this ?


This problem is a really big one and I would expect more attention to it :confused:
My Java program was working perfectly with previous versions of ES.

I found the solution when I asked in Stackoverflow:

The solution was as straightforward as:

network.bind_host: 0

I found it here. It's a problem with the interface in which elasticsearch is bound