title: Spring Data ElasticSearch Can't Connect with ElasticSearch 5.5.0
body: <p>Am new to ElasticSearch... </p>
  
  <p>Really love the API (especially ElasticsearchTemplate &amp; supporting Unit Tests)...</p>
  
  <p>Was following this example using ElasticSearch 5.5.0 (the following link has the full code inline and also available as a downloadable zip file):</p>
  
  <p><a href="https://www.mkyong.com/spring-boot/spring-boot-spring-data-elasticsearch-example/" rel="nofollow noreferrer">https://www.mkyong.com/spring-boot/spring-boot-spring-data-elasticsearch-example/</a></p>
  
  <p>maven dependencies:</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.5.1.RELEASE&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;properties&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-elasticsearch&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>EsConfig:</p>
  
  <pre><code>@Configuration
  @EnableElasticsearchRepositories(basePackages = "com.mkyong.book.repository")
  public class EsConfig {
  
      @Value("${elasticsearch.host}")
      private String EsHost;
  
      @Value("${elasticsearch.port}")
      private int EsPort;
  
      @Value("${elasticsearch.clustername}")
      private String EsClusterName;
  
      @Bean
      public Client client() throws Exception {
  
          Settings esSettings = Settings.settingsBuilder()
                  .put("cluster.name", EsClusterName)
                  .build();
  
          //https://www.elastic.co/guide/en/elasticsearch/guide/current/_transport_client_versus_node_client.html
          return TransportClient.builder()
                  .settings(esSettings)
                  .build()
                  .addTransportAddress(
                    new InetSocketTransportAddress(InetAddress.getByName(EsHost), EsPort));
      }
  
      @Bean
      public ElasticsearchOperations elasticsearchTemplate() throws Exception {
          return new ElasticsearchTemplate(client());
      }
  }
  </code></pre>
  
  <p>src/main/resources:</p>
  
  <pre><code>elasticsearch.clustername = mkyong-cluster
  elasticsearch.host = localhost
  elasticsearch.port = 9300
  </code></pre>
  
  <p>When issuing the following, either:</p>
  
  <pre><code>mvn spring-boot:run
  </code></pre>
  
  <p>or </p>
  
  <pre><code>mvn clean test
  </code></pre>
  
  <p>stdout:</p>
  
  <pre><code>Caused by: NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{127.0.0.1}{127.0.0.1:9300}]]
     at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:326)
     at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:223)
     at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55)
  </code></pre>
  
  <p>Also, get the following in my ElasticSearch 5.5.0 engine's stdout:</p>
  
  <pre><code>[2017-07-23T02:48:46,135][WARN ][o.e.t.n.Netty4Transport  ] [vY7jxpr] exception caught on transport layer [[id: 0xa7e950be, L:/127.0.0.1:9300 - R:/127.0.0.1:60190]], closing connection
      java.lang.IllegalStateException: Received message from unsupported version: [1.0.0] minimal compatible version is: [5.0.0]
          at org.elasticsearch.transport.TcpTransport.messageReceived(TcpTransport.java:1379) ~[elasticsearch-5.5.0.jar:5.5.0]
          at org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:74) ~[transport-netty4-5.5.0.jar:5.5.0]    
  </code></pre>
  
  <p>Is there any way to use Spring Data ElasticSearch with ElasticSearch 5.5.0 engine?</p>
  
  <p>If so, how would the connection be implemented? </p>
  
  <p>I am using the Elastic Search Java client provided by Elastic Search and am able to connect and create indices on ElasticSearch 5.5.0 but really wish I could use the power of this library.</p>