Spring boot 和 elastic search 不受支持的版本 最低兼容版本

Spring boot and elastic search unsupported version minimal compatible version

这是我的pom.xml

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 it.test 搜索测试 0.0.1-快照

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.0.M5</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>

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

    </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>

当我开始我的项目时,我返回了这个堆栈跟踪:

    [2017-12-15T13:36:15,670][WARN ][o.e.t.n.Netty4Transport  ] [node1] exception caught on transport layer [org.elasticsearch.transport.netty4.NettyTcpChannel@7c08d374], closing connection
java.lang.IllegalStateException: Received message from unsupported version: [5.5.3] minimal compatible version is: [5.6.0]
        at org.elasticsearch.transport.TcpTransport.ensureVersionCompatibility(TcpTransport.java:1428) ~[elasticsearch-6.1.0.jar:6.1.0]
        at org.elasticsearch.transport.TcpTransport.messageReceived(TcpTransport.java:1375) ~[elasticsearch-6.1.0.jar:6.1.0]
        at org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:64) ~[transport-netty4-6.1.0.jar:6.1.0]

我必须在我的 pom 中更改什么才能解决此不兼容问题?

谢谢

将传输版本更改为与您的 elasticsearch 实例相同

你的 ElasticSearch 是什么版本,也许你可以尝试在你的 pom 中添加这个 属性 像这样。

<properties>
    <elasticsearch.version>6.1.0</elasticsearch.version>
</properties>

我也遇到了类似的错误但得到了解决,在此之前我想突出显示我的 spring 引导启动器父版本,即 1.5。9.RELEASE,其次我使用的是 spring -boot-starter-data-elasticsearch artifact alone for spring boot elastic search 和其他 artifacts 可以被删除,最后你在安装的 elastic search 应用程序中收到的惊人问题,尝试下载这个版本 https://www.elastic.co/downloads/past-releases/elasticsearch-2-4-0 再试一次....

我总是发现 Spring data elasticsearch matrix table 有助于确定要使用的兼容版本。

要将 ES 的版本从更改为兼容版本,请使用 Spring 引导专用模块指定依赖版本。添加 elasticsearch.version 到您的 pom 属性

<properties>
    ...
    <elasticsearch.version>1.7.2</elasticsearch.version>
    ...
</properties>