Unable to connect Elastic Search Java Client to Elastic Search : 5.4.3

I am having trouble connecting java client to elastic search 5.4.3. I am using below stack:

  • dockerised version of elasticsearch:5.4.3

  • elastic search client

<dependency>
		<groupId>org.elasticsearch.client</groupId>
		<artifactId>transport</artifactId>
		<version>5.4.3</version>
</dependency>

Below is response of http://localhost:9200/_nodes/http?pretty

{
  "_nodes" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "cluster_name" : "elasticsearch",
  "nodes" : {
    "XU8oSxxJQFmrbwWHJTdokQ" : {
      "name" : "XU8oSxx",
      "transport_address" : "127.0.0.1:9300",
      "host" : "127.0.0.1",
      "ip" : "127.0.0.1",
      "version" : "5.4.3",
      "build_hash" : "eed30a8",
      "roles" : [
        "master",
        "data",
        "ingest"
      ],
      "attributes" : {
        "ml.enabled" : "true"
      },
      "http" : {
        "bound_address" : [
          "[::1]:9200",
          "127.0.0.1:9200",
          "172.19.0.2:9200"
        ],
        "publish_address" : "127.0.0.1:9200",
        "max_content_length_in_bytes" : 104857600
      }
    }
  }
}

Below is java-config:
TransportClient client = new PreBuiltTransportClient(settings).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));

I am not getting any error while initialising the client. Whenever i perform a search query like

client.prepareSearch("nat-search").setTypes("csv")
		.setQuery(QueryBuilders.termQuery("obj_val", searchRequestDto.getKeyword())).get();

, i am getting below response:
None of the configured nodes are available: [{#transport#-1}{52YhIsGTR76VlR9g9zsurA}{localhost}{127.0.0.1:9300}]

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