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'
There are some possible reasons for this: