Версия Elasticsearch для Spring Boot 2.1 - PullRequest
0 голосов
/ 13 ноября 2018

В моем проекте Spring Boot ( 2.0.5 ) я использовал Elasticsearch ( 5.6.9 ). Однако из-за некоторых ошибок в тестовой среде мы переходим к загрузке Spring ( 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>

Может кто-нибудь сказать, какая версияasticsearch совместима с Spring Boot 2.1.0? Я прочитал похожие вопросы, которые были устаревшими. Совместимые версии пружинных загрузочных, эластичных и пружинных данных эластичных поисков

Ответы [ 2 ]

0 голосов
/ 05 апреля 2019

Вы можете перейти в Проект Spring Boot Хранилище Github и проверить любую версию зависимости:

  • В Spring Boot 2.0.x версия Elasticsearch определяется как 5.6.16 ( ссылка )
  • В Spring Boot 2.1.x версия Elasticsearch определяется как 6.4.3 ( ссылка )
0 голосов
/ 02 апреля 2019

Не уверен, что это все еще актуально, но первое, что вам нужно попробовать, это добавить базовую библиотеку Elasticsearch, потому что REST-клиент зависит от нее.

<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>6.7.0</version>
</dependency>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...