0

I'm trying the most basic case to connect to my ES cluster, but it seems that the host I register are not being registered. This is the code I'm running:

//Create the client
Client client = new TransportClient(ImmutableSettings.builder()
    .put("cluster.name", "MyCluster")
    .put("client.transport.sniff","true").build())
    .addTransportAddresses(
        new InetSocketTransportAddress("host1", 9300),
        new InetSocketTransportAddress("host2", 9300));

// Try to make a call
SearchRequest sr = new SearchRequest().indices("MyIndex");
ActionFuture<SearchResponse> search = client.search(sr);
SearchResponse actionGet = search.actionGet(); // <-- Exception
System.out.println(actionGet.toString());

client.close();

This is the exception I get:

Exception in thread "main" org.elasticsearch.client.transport.NoNodeAvailableException:
None of the configured nodes are available: []

It looks like it there is no connected nodes, what am I missing?

NOTE: I'm using the elastic search client with gradle:
compile 'org.elasticsearch:elasticsearch:1.7.5'

5
  • Is your cluster working properly? Does the versions of yout client and server same/compatible? Commented Apr 26, 2016 at 13:20
  • 1
    The cluster is working fine with REST calls. And I think I have the same versions, how do I check the version on the server? Commented Apr 26, 2016 at 13:22
  • Just type curl -XGET 'http://host:9200. Also check for cluster name. Commented Apr 26, 2016 at 13:26
  • You right, it was a version error. Thanks. Commented Apr 26, 2016 at 13:41
  • 1
    @Gavirel I also answer the question Commented Apr 26, 2016 at 13:53

1 Answer 1

2

There are some possible reasons for this:

  • The client and server versions can be different
  • Cluster name can be different
  • There could be a network problem when accesing the host and port.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.