ElasticSearch in docker : NoNodeAvailableException

Hello, i'm trying to set up ElasticSearch using docker. I've followed this guide: https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html running it in development mode, so using:

`docker run -p 9200:9200 -p 9300:9300 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" docker.elastic.co/elasticsearch/elasticsearch:5.4.3`

The only thing i've changed is the port mapping, as i guess the 9300 is also necessary.The docker image seems to run fine, i can send queries to it using Sense and check /health and /nodes

My TransportClient.java looks like this:

@Bean
TransportClient transportClient() throws UnknownHostException {
	Settings settings = Settings.builder().put(TAG_CLUSTER_NAME, clusterName).put(TAG_TRANSPORT_SNIFF, false)
			.put(TAG_TRANSPORT_PING_TIMEOUT, 20, TimeUnit.SECONDS).build();
	TransportClient client = new PreBuiltTransportClient(settings);
	client.addTransportAddresses(new InetSocketTransportAddress(InetAddress.getByName(host), 9300));

	return client;
}

And my application.yml is:

elasticsearch.cluster.name: docker-cluster
elasticsearch.host: localhost

But i'm getting the following error:

ERROR org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository - failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{OH4x9CkPQyieRcmQjzbFWw}{localhost}{127.0.0.1:9300}]

I have tried changing many configuration parameters, like transport.host, network.host, changing the ports, the cluster name, etc, but i'm always getting the same error. I'm probably missing something very simple, but i cant see it, can you help me?

Thanks

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.