Elasticsearch 7.17,Spring Data Elasticsearch和Elasticsearch-Rest-Rest-Rest-High-Client之间的兼容性(作为Spring Boot Maven依赖关系)
我有一个Spring Boot + Elasticsearch应用程序,该应用程序具有现已弃用的高级REST客户端。我试图将现有的查询/方法迁移到新的Java API客户端,但要保留HLRC(以防万一我破坏任何东西)。
我似乎遇到了一个我没有得到的依赖性问题。我当前正在获取错误java.lang.noclassdeffounderror:org/elasticsearch/xcontent/toxContentObject
,我认为这是由于兼容性问题。这些是我当前的(相关)依赖性:
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.17.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>4.3.4</version>
</dependency>
Elasticsearch在7.17上。至于Maven依赖关系...我真的不知道要使用哪些版本,以便在测试更新的代码时可以运行旧的HLRC? (因此,我将版本设置为最新可能的版本)
编辑Infos:
- 当前的Spring Boot版本为2.2.8,
- 然后手动设置该版本,org.elasticsearch.client在6.8.x上
- 是我的愚蠢的,我应该只是删除所有的所有方法HLRC赞成实施/测试Java API客户端?
任何指示/修复程序都值得赞赏!
I have an Spring Boot + Elasticsearch application that had the now deprecated High Level Rest Client. I am trying to migrate the existing queries/methods to the new Java API Client but want to keep the HLRC for a bit (in case I break anything).
I seem to be running into a dependency problem that I'm not getting. I am currently getting the error java.lang.NoClassDefFoundError: org/elasticsearch/xcontent/ToXContentObject
which I assume is due to compatibility issues. These are my current (relevent) dependencies:
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.17.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>4.3.4</version>
</dependency>
The Elasticsearch is on 7.17 . As for the maven dependencies... I don't really know what versions to use so that it can run the old HLRC still while I test out newer code? (So I set the versions to the newest possible ones)
Edit infos:
- current spring boot version is 2.2.8
- before manually setting the version, org.elasticsearch.client was on 6.8.x
- is my approach dumb and I should just scrap all the HLRC in favor of implementing/testing Java API Client?
Any pointers/fixes appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我没记错的话,在版本7.15或7.16中,Elasticsearch的变化使XCONTENT类的变化发生了不断变化。您不能使用Elasticsearch 7.17使用Spring Data Elasticsearch 4.3.x
If I remember correctly it was in version 7.15 or 7.16 that Elasticsearch had a breaking change moving the xcontent classes to a different package. You cannot use Spring Data Elasticsearch 4.3.x with Elasticsearch 7.17