1

In elasticsearch, when I try to create a index and type I got this exception. "None of the configured nodes are available: []" The following are the code which I use to create "preparIndex".

public class Test {
    static {
        CLIENT = new TransportClient().addTransportAddress(new InetSocketTransportAddress("localhost", 13101));
    }

    public static void main(String arg[]) {
        try {
            IndexResponse response = CLIENT
                                        .prepareIndex("twitter", "tweet", "1")
                                        .setSource(jsonBuilder()
                                            .startObject()
                                            .field("user", "kimchy")
                                            .field("postDate", new Date())
                                            .field("message", "trying out Elasticsearch")
                                            .endObject())
                                        .execute()
                                        .actionGet();
        } catch(Exception e) {
            System.out.println(e.getMessage());
        }   
    }
}

Can any one help me. Thank you.

pbaris
  • 4,525
  • 5
  • 37
  • 61
Rajesh
  • 78
  • 2
  • 8
  • What's the status of your cluster? Are the nodes running okay? – Olly Cruickshank Jan 07 '15 at 09:52
  • 1
    Wild quess: Port number should be 9300 (not 13101). As @OllyCruickshank suggested, be sure that ES is running on localhost on the default port. – Zouzias Jan 07 '15 at 16:03
  • @OllyCruickshank I am facing a similar problem connecting to elasticsearch single node cluster version 1.7. I am using the java client library version 1.7 and my cluster state is Green and I am also able to connect to the node on port 9300 via telnet. But I keep getting the following error: org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [] – Mrugen Deshmukh Jul 21 '15 at 16:46
  • Duplicate of this ? https://stackoverflow.com/questions/32277401/org-elasticsearch-client-transport-nonodeavailableexception-none-of-the-configu – tuxdna Oct 22 '15 at 20:24

1 Answers1

1

I had the same issue and finally found the reason, that is I used the default port 9200 (the correct is 9300 as default).

Yaron
  • 10,166
  • 9
  • 45
  • 65
jlian
  • 26
  • 1