0

We have a web service running on spring-boot 2.3 with spring-data-r2dbc, which is only available since spring-boot 2.3.

Recently we need to integrate with an existing elasticsearch 6.x cluster, which is not supported by the spring-data-elasticsearch 4.0 that comes with spring-boot 2.3.

I tried to explicitly declare dependency spring-data-elasticsearch 3.2.10 (which supports the 6.x es cluster), however I can see elasticsearch-rest-high-level-client 7.6.2 (this dependency is the root cause of spring-data-elasticsearch 4.0 not supporting 6.x es cluster any more) still loaded regardless of version 6.8.12 declared in spring-data-elasticsearch 3.2.10's pom.xml.

I am using gradle with io.spring.dependency-management and org.springframework.boot plugins. I am wondering how I can stay with spring-boot 2.3, while opting for spring-data-elasticsearch 3.2.10 properly?

========== EDIT ==========

I came across this post Why does Gradle downgrade my transitive dependencies in a Grails 3.1 application? and figured that it is because of io.spring.dependency-management gradle plugin enforcing the elasticsearch version to 7.6.2.

I changed it by ext["elasticsearch.version"] = 6.8.12 and now elasticsearch version is expected.

However, I am still not sure if overriding versions in this way will cause any unforeseen issue.

GJ.
  • 870
  • 5
  • 9
  • 26

1 Answers1

1

I don't have a gradle setup to test this, but with maven you need two things:

set the property for the Elasticsearch version and the dependency for Spring Data Elasticsearch:

    <properties>
        <elasticsearch.version>6.8.4</elasticsearch.version>
    </properties>

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-elasticsearch</artifactId>
        <version>3.2.10.RELEASE</version>
    </dependency>

A first test with a sample program seems to be running ok, but there may be problems, because both spring-data-elasticsearch and spring-data-r2dbc depend on spring-data-commons now in different versions; you'll have to try.

P.J.Meisch
  • 18,013
  • 6
  • 50
  • 66
  • Thank you! I guess r2dbc is in the safe side as the commons loaded should be the one enforced by the spring boot dependencies 2.3. If elastic search has problem I guess we will have to not use the reactive client from spring-data-elasticsearch but use custom webclient rest API interactions... – GJ. Oct 06 '20 at 14:33