org.elasticsearch.common.transport.InetSocketTransportAddress not found on Elasticsearch 6 org.elasticsearch.common.transport.InetSocketTransportAddress not found on Elasticsearch 6 elasticsearch elasticsearch

org.elasticsearch.common.transport.InetSocketTransportAddress not found on Elasticsearch 6


Elastic search 6.0 has removed InetSocketTransportAddress class. I have solved this By replacing InetSocketTransportAddress class with TransportAddress class.

// on startupTransportClient client = new PreBuiltTransportClient(Settings.EMPTY)        .addTransportAddress(new TransportAddress(InetAddress.getByName("host1"), 9300))        .addTransportAddress(new TransportAddress(InetAddress.getByName("host2"), 9300));// on shutdownclient.close();


There are many solutions offered to the problem, but I was getting this error because, as I was trying to make a basic elasticsearch configuration with SpringBoot:

I forgot to start elasticsearch...

:facepalm:

So, just:

  1. open command line at bin folder in your Elasticsearch installation directory*
  2. type elasticsearch
  3. press Enter

To make sure it works, open http://localhost:9200/ in your browser. You should get a JSON response containing name, cluster_name, elasticsearch version etc.

*(On Windows) Open ES_INSTALLATION_DIR\elasticsearch-x.x.x\bin folder, hold Shift key, right click on the folder area and from the drop-down menu select Open command window here.


In my case the issue was conflicting version of the elasticsearch that was pulled into my project by the spring-boot-dependencies. If your pom does not inherit from the spring-boot-starter-parent but instead uses dependencyManagement section to import spring-boot-dependencies and you need an older version of the elasticsearch on the classpath then here is the solution: InetSocketTransportAddress. Always run mvn -Dverbose=true help:effective-pom and inspect effective pom for conflicts. -Dverbose=true is critical here. It allows to see where the unwanted dependency is coming from.