简体   繁体   English

Spring Boot 2.1的Elasticsearch版本

[英]Elasticsearch version for Spring Boot 2.1

In my Spring Boot ( 2.0.5 ) project I was using Elasticsearch ( 5.6.9 ). 在我的Spring Boot2.0.5 )项目中,我正在使用Elasticsearch5.6.9 )。 However, due to some bugs in testing environment we are moving to Spring boot( 2.1.0 ). 但是,由于测试环境中的一些错误,我们将转向Spring boot( 2.1.0 )。 When I run the application the following message comes up: 当我运行该应用程序时,出现以下消息:

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call the method org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder.execute()Lorg/elasticsearch/action/ActionFuture; but it does not exist. Its class, org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder, is available from the following locations:

    jar:file:/C:/Users/User/.m2/repository/org/elasticsearch/elasticsearch/5.6.9/elasticsearch-5.6.9.jar!/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequestBuilder.class

It was loaded from the following location:

    file:/C:/Users/User/.m2/repository/org/elasticsearch/elasticsearch/5.6.9/elasticsearch-5.6.9.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder


Process finished with exit code 0

Current pom.xml file 当前的pom.xml文件

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.0.RELEASE</version>
        <relativePath/>
    </parent>
    <properties>
        <elasticsearch.version>5.6.9</elasticsearch.version>
    </properties>
    <dependencies>

        <!--...others...-->     

        <!--ELASTICSEARCH-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>transport</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.plugin</groupId>
            <artifactId>transport-netty4-client</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
    </dependencies>

Previous pom.xml file which worked fine: 以前的pom.xml文件运行良好:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.5.RELEASE</version>
        <relativePath/> 
    </parent>
    <properties>
        <elasticsearch.version>5.6.9</elasticsearch.version>
    </properties>
    <dependencies>

        <!--...others...-->     

        <!--ELASTICSEARCH-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>transport</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.plugin</groupId>
            <artifactId>transport-netty4-client</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
    </dependencies>

Can someone tell which version of elasticsearch is compatible with Spring Boot 2.1.0? 有人可以说出哪个版本的elasticsearch与Spring Boot 2.1.0兼容吗? I read through similar questions which were outdated. 我通读过时的类似问题。 Compatible versions of Spring boot,elasticsearch and spring data elasticsearch Spring Boot,elasticsearch和spring数据elasticsearch的兼容版本

You can go to Spring Boot project Github repository and check any dependency version: 您可以转到Spring Boot项目 Github存储库并检查任何依赖版本:

  • In Spring Boot 2.0.x Elasticsearch version is defined as 5.6.16 ( link ) 在Spring Boot 2.0.x中,Elasticsearch版本定义为5.6.16( 链接
  • In Spring Boot 2.1.x Elasticsearch version is defined as 6.4.3 ( link ) 在Spring Boot 2.1.x中,Elasticsearch版本定义为6.4.3( 链接

Not sure if it's still actual, but the first thing you need to try is to add core Elasticsearch library, because REST client depends on it. 不知道它是否仍然是实际的,但是您需要尝试的第一件事是添加核心Elasticsearch库,因为REST客户端依赖它。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM