1
votes

I'm creating an application using Spring Boot and also Elastic-Search. Spring application part is working. And also when I start Elastic server, it's also running well. No issues at all. I can test it via POSTMAN and also CURL. Adding and also searching works well.

But when I run the application, i'm getting following issues. This is the issue i'm getting in the IDE. (which means from my java application)

org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{127.0.0.1}{127.0.0.1:9300}]

And this is the issue i'm getting from the Elasctic server on my local system.

java.lang.IllegalStateException: Received message from unsupported version: [2.0.0] minimal compatible version is: [5.0.0]

These are the libraries I'm using.

  • Spring Boot 1.5.1.RELEASE
  • Spring Boot Starter Data Elasticsearch 1.5.1.RELEASE
  • Spring Data Elasticsearch 2.10.RELEASE
  • Elastic Search 5.0

I think this is a issue with Elastic and above library version mismatch. I'm new to Elastic and also Spring. The version issue is here. https://github.com/spring-projects/spring-data-elasticsearch/wiki/Spring-Data-Elasticsearch---Spring-Boot---version-matrix

And also here is my pom.xml. If I need to update any library, can anyone tell me what's that ? And also tell me how to update those libraries ? Can I update them without changing to my source code ?

<?xml version="1.0" encoding="UTF-8"?>

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

<artifactId>springboot-springdata-elasticsearch-example</artifactId>
<packaging>jar</packaging>
<url>https://www.mkyong.com</url>
<version>1.0</version>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.1.RELEASE</version>
</parent>

<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <!-- Runtime, for Embedded Elasticsearch,
        comment this if connect to external elastic search server-->
    <dependency>
        <groupId>net.java.dev.jna</groupId>
        <artifactId>jna</artifactId>
        <scope>runtime</scope>
    </dependency>

</dependencies>

<build>
    <plugins>
        <!-- Package as an executable jar/war -->
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

In this pom.xml , I can't find all the dependencies too.

1
According to the version matrix you linked to, you cannot use elasticsearch 5.x with the Spring libraries you want to use. Are you running elasticsearch externally? It looks like it. You need to run a 2.x of elasticsearch.Phil
@Phil Hey what are the changes between elastic 2.x and 5.x ?Chanaka De Silva
@Phil Can I update Spring libraris to use Elastic 5.x ? Please HELP meChanaka De Silva

1 Answers

1
votes

According to the versions matrix that you provided, the spring boot version that you're using is not compatible with ElasticSearch 5.x instances. So, i think you have 3 options:

  • If you really need to work with SpringBoot 1.5.1 using ElasticSearch 5.0, you should add the maven dependencies related to ElasticSearch 5.0 and implement your own DAO service.
  • You can try to downgrade your ElasticSearch version to 2.4 in order to make it compatible with your current spring boot version.
  • Maybe you can try to use the recent spring boot version (1.5.4) because arcording to the spring-data-elasticsearch project (https://github.com/spring-projects/spring-data-elasticsearch/), the last version supports ElasticSearch 5.x, so probably it could be the easiest way.

Please let me know if any of options above was useful for you.