Java Client conncetion

Hi, i am new with Elasticsearch and i am trying to execute a simple search query.

     Settings settings = Settings.settingsBuilder()
    .put("cluster.name", "elasticsearch").build();
    Client client = TransportClient.builder().settings(settings).build()
    .addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("127.0.0.1", 9300)));

    SearchResponse response = client.prepareSearch("logstash-2016.04.22")
    .execute()
    .actionGet();
    System.out.println(response);

and Here the error logs:

            avr. 22, 2016 6:41:45 PM org.elasticsearch.transport.netty.NettyTransport exceptionCaught
            AVERTISSEMENT: [Ereshkigal] exception caught on transport layer [[id: 0x8e5bd9b6, /127.0.0.1:61531
             => /127.0.0.1:9300]], closing connection

-elasticsearch is running on the port 9300
-cluster name is elasticsearch
-the index is "logstash-2016.04.22"
-i am calling this code in a spring MVC controller

I am heared that it's a version problem isue so i am asking here.

Thank you in advence.

Which versions on both side?

I am using java jre 1.8:

and elasticsearch-2.3.0

Elasticsearch server is 2.3.0. Which client version? How does your pom look like?

1 Like
    <dependency>
           <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient</artifactId>
         <version>4.3-beta1</version>
    </dependency> 

   <dependency>
       <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>2.3.0</version>
   </dependency>

if that's what you mean with client

I just added Client configuration to my pom.xml

          <dependency>
		<groupId>io.appium</groupId>
		<artifactId>java-client</artifactId>
		<version>3.4.1</version>
	  </dependency>

Thank you !

I have no idea. May be you have a bigger stacktrace? More logs?