NoNodeAvailableException, cannot connect SpringBoot 2.0 and Elasticsearch5.5.0


I know it was discussed several times however after reading all threads I am still not able connect SpringBoot 2.0 application to ElasticSearch 5.5.0 while using TransportClient (as Java High-Level REST Client was released in ver 5.6.0 i can't use it).

Here's my application so far:






config class
@EnableElasticsearchRepositories(basePackages = "com.example.demo")
public class EsConfig {

    private String EsHost;

    private int EsPort;

    private String EsClusterName;

    public Client client() throws Exception {

        Settings esSettings = Settings.builder()
                .put("", EsClusterName)

        TransportClient client = new PreBuiltTransportClient(esSettings)
                .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(EsHost), Integer.valueOf(EsPort)));
        return client;

    public ElasticsearchOperations elasticsearchTemplate() throws Exception {
        return new ElasticsearchTemplate(client());
elasticsearch.clustername = elasticsearch = localhost
elasticsearch.port = 9300

As i run the application I get an error:

failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{ru3fMzoqTQygBpT5C6KXXw}{localhost}{}]

My elasticsearch is running in docker container

run -p 9200:9200 -p 9300:9300 --name elasticsearch -d --network mynetwork elasticsearch:5.5.0

TransportClient is set to listen on Port 9300
SpringBoot 2.0 should be compatible with Elastic 5.X
Does anyone know what could I change in order to make it work ?

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