How to fix [types removal] Specifying types in search requests is deprecated."] (elasticsearch 7.4.0 ,spring boot 2.2.6)?

Viewed 3730

I'm developing my first application that uses elasticsearch (7.4.0) as database and I use for that spring data elasticsearch ( spring boot version is 2.2.6),every thing is working fine but I still get the following warning logs messages when I run my app.

Using include_type_name in put mapping requests is deprecated. The parameter will be removed in the next major version."]
[types removal] Specifying types in search requests is deprecated."]

I know about types removal since 7.0.0 version ,but how can I fix that ,I mean should I change my spring boot version or my elasticsearch version,how can I remove those warning messages ? Will ignoring those warnings impact the application process ?

1 Answers

Spring Boot 2.2.6 pulls in Spring Data Elasticsearch 3.2. and the Elasticsearch client libraries in version 6.8.7. This cannot work with an Elasticsearch cluster running version 7. You will need the Elasticsearch client libraries in at least version 7.4.0 and Spring Data Elasticsearch in version 4.0

You can do two things:

  1. Explicitly specify the versions of Spring Data (realease train Neumann contains Spring Data Elasticsearch 4.0) and Elasticsearch to use by setting the properties in your pom.xml see the documentation:
    <properties>
        <elasticsearch.version>7.4.0</elasticsearch.version>
        <spring-data-releasetrain.version>Neumann-RELEASE</spring-data-releasetrain.version>
    </properties>
  1. Use Spring Boot 2.3. This will pull in Spring Data in the same version as above and Elasticsearch client libraries in version 7.6 - which will work with you 7.4 cluster.

I'd prefer to use the second.

Related