Increase elasticsearch version when importing resthighlevelclient

Hello people. I am using resthighlevelclient to connect to elasticsearch 7.9.3. Now I have done by importing all of this:

 <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>7.9.3</version>
        </dependency>


        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-client</artifactId>
            <version>7.9.3</version>
        </dependency>

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

All according to this question here:

Now I would like to to know if there is a way to import just the rest high level client. When doing so I end up seeing this in my dependency tree:

[INFO] \- org.elasticsearch.client:elasticsearch-rest-high-level-client:jar:7.9.3:compile
[INFO]    +- org.elasticsearch:elasticsearch:jar:6.4.3:compile
[INFO]    |  +- org.elasticsearch:elasticsearch-core:jar:6.4.3:compile
[INFO]    |  +- org.elasticsearch:elasticsearch-secure-sm:jar:6.4.3:compile
[INFO]    |  +- org.elasticsearch:elasticsearch-x-content:jar:6.4.3:compile
[INFO]    |  |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.9.8:compile
[INFO]    |  |  \- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.9.8:compile
[INFO]    |  +- org.apache.lucene:lucene-core:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-analyzers-common:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-backward-codecs:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-grouping:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-highlighter:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-join:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-memory:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-misc:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-queries:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-queryparser:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-sandbox:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-spatial:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-spatial-extras:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-spatial3d:jar:7.4.0:compile
[INFO]    |  +- org.apache.lucene:lucene-suggest:jar:7.4.0:compile
[INFO]    |  +- org.elasticsearch:elasticsearch-cli:jar:6.4.3:compile
[INFO]    |  +- com.carrotsearch:hppc:jar:0.7.1:compile
[INFO]    |  +- com.tdunning:t-digest:jar:3.2:compile
[INFO]    |  +- org.apache.logging.log4j:log4j-api:jar:2.11.2:compile
[INFO]    |  \- org.elasticsearch:jna:jar:4.5.1:compile
[INFO]    +- org.elasticsearch.client:elasticsearch-rest-client:jar:6.4.3:compile
[INFO]    |  +- org.apache.httpcomponents:httpclient:jar:4.5.8:compile
[INFO]    |  +- org.apache.httpcomponents:httpcore:jar:4.4.11:compile
[INFO]    |  +- org.apache.httpcomponents:httpasyncclient:jar:4.1.4:compile
[INFO]    |  +- org.apache.httpcomponents:httpcore-nio:jar:4.4.11:compile
[INFO]    |  \- commons-codec:commons-codec:jar:1.11:compile
[INFO]    +- org.elasticsearch.plugin:mapper-extras-client:jar:7.9.3:compile
[INFO]    +- org.elasticsearch.plugin:parent-join-client:jar:7.9.3:compile
[INFO]    +- org.elasticsearch.plugin:aggs-matrix-stats-client:jar:7.9.3:compile
[INFO]    +- org.elasticsearch.plugin:rank-eval-client:jar:7.9.3:compile
[INFO]    \- org.elasticsearch.plugin:lang-mustache-client:jar:7.9.3:compile
[INFO]       \- com.github.spullara.mustache.java:compiler:jar:0.9.6:compile

It looks like the client always imports elasticsearch 6.4.3. This is a problem for me (see the above stack overflow question).

Anyway, thanks for any help. Cheers!

Please don't post images of text as they are hard to read, may not display correctly for everyone, and are not searchable.

Instead, paste the text and format it with </> icon or pairs of triple backticks (```), and check the preview window to make sure it's properly formatted before posting it. This makes it more likely that your question will receive a useful answer.

When using springboot with elasticsearch, you need to be explicit with some transitive dependencies as SpringBoot declares a version 6.4...

Basically you can put this in your pom.xml:

<properties>
  <elasticsearch.version>7.11.1<elasticsearch.version>
</properties>

See documentation here: “How-to” Guides

Edited to paste code instead of an image. Thanks! works perfectly.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.