Skip to content
Advertisement

Elasticsearch TransportClient connection [Java]

I am using Elasticsearch in a Java Project using Maven:

JavaScript

When I try to initialize a TransportClient in order to index a document it gives me the error:

JavaScript

Maybe a need to add more information in config/elasticsearch.yaml about transportartion or the current configuration is wrong.

Java code:

JavaScript

elasticsearch.yaml:

JavaScript

(The other info inside elasticsearch.yaml is commented)

localhost:9200 gives me:

JavaScript

Advertisement

Answer

I solved the problem. The issue was that I was using Elasticsearch 6.7.0 version with TransportClient, which is deprecated and replaced by RestHighLevelClient. Also, I had to use port 9200 and to uncomment http.port: 9200 and discovery.seed_hosts: [“host1”, “host2”] from elasticsearch.yaml

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement