繁体   English   中英

Spring Boot 2.1的Elasticsearch版本

[英]Elasticsearch version for Spring Boot 2.1

在我的Spring Boot2.0.5 )项目中,我正在使用Elasticsearch5.6.9 )。 但是,由于测试环境中的一些错误,我们将转向Spring boot( 2.1.0 )。 当我运行该应用程序时,出现以下消息:

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

当前的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>

以前的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>

有人可以说出哪个版本的elasticsearch与Spring Boot 2.1.0兼容吗? 我通读过时的类似问题。 Spring Boot,elasticsearch和spring数据elasticsearch的兼容版本

您可以转到Spring Boot项目 Github存储库并检查任何依赖版本:

  • 在Spring Boot 2.0.x中,Elasticsearch版本定义为5.6.16( 链接
  • 在Spring Boot 2.1.x中,Elasticsearch版本定义为6.4.3( 链接

不知道它是否仍然是实际的,但是您需要尝试的第一件事是添加核心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