简体   繁体   English

我可以在旧版本的Elasticsearch上使用新版本的Java高级别Rest客户端吗?

[英]Can I use newer version of java high level rest client on an older version of elasticsearch?

We are running elasticsearch on AWS which currently supports elasticsearch 6.3 as the latest version. 我们正在AWS上运行elasticsearch,该AWS当前支持最新版本的Elasticsearch 6.3。

We have a business case where we need to update all the documents in the index and remove one nested object everyday. 我们有一个业务案例,需要每天更新索引中的所有文档并删除一个嵌套对象。 There is elasticsearch's Update by query API which will solve our purpose. 有Elasticsearch的按查询更新API ,可以解决我们的目的。

But in our java application we are using Java high level rest client. 但是在我们的Java应用程序中,我们使用Java高级Rest客户。 The update by query api is being supported by the rest client version 6.5 . 其余客户端版本6.5支持通过查询api更新。 Now if we upgrade the rest client to 6.5, we need to upgrade the elasticsearch version in our pom as well. 现在,如果将其余客户端升级到6.5,我们也需要在pom中升级elasticsearch版本。 Otherwise they aren't compatible. 否则,它们将不兼容。

    <dependency>
        <groupId>org.elasticsearch.client</groupId>
        <artifactId>elasticsearch-rest-high-level-client</artifactId>
        <version>${elasticsearch.version}</version>
    </dependency>

    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>${elasticsearch.version}</version>
    </dependency>

So can we upgrade the client and elasticsearch version to 6.5 in our java service and still use the elasticsearch 6.3? 那么我们可以在我们的java服务中将client和elasticsearch版本升级到6.5并仍然使用elasticsearch 6.3吗? I tried it and it works, but just want to be thorough as we don't want our data to be corrupted. 我尝试了一下,它确实有效,但是只是想更彻底,因为我们不想破坏我们的数据。

Edit: The Update by query is also available in 6.3 but this api uses the older Transportclient which is supposed to be deprecated soon. 编辑:通过查询更新在6.3中也可用,但是此api使用的旧版Transportclient应该很快就被弃用。

According to Elasticsearch , 根据Elasticsearch的说法,

running a mixed version cluster is something we only recommend during the upgrade process, not as the status quo. 我们仅建议在升级过程中运行混合版本集群,而不是现状。 Having older versions of nodes or clients in the cluster limits the support of newer features, as the older client simply doesn't know how to write or read requests in the newer binary format. 集群中具有较旧版本的节点或客户端会限制对较新功能的支持,因为较旧的客户端根本不知道如何以较新的二进制格式写入或读取请求。

This should also apply the other way round (newer Client for old ES-Version) 这也应该反过来适用(旧ES版本的新客户端)

In addidition, in this Recommendation , noted by @Samuel Kok, states: 此外,@ Samuel Kok指出的本建议书还指出:

The client should always be updated last, once all of the nodes in the cluster have been upgraded to the new major version. 一旦集群中的所有节点都已升级到新的主要版本,客户端应始终最后更新。

Based on the Elastic Search Documentation 基于弹性搜索文档

The High Level Client is guaranteed to be able to communicate with any Elasticsearch node running on the same major version and greater or equal minor version. 确保高级客户端能够与在相同主要版本和较大或相等的次要版本上运行的任何Elasticsearch节点进行通信。

The 6.0 client is able to communicate with any 6.x Elasticsearch node, while the 6.1 client is for sure able to communicate with 6.1, 6.2 and any later 6.x version, but there may be incompatibility issues when communicating with a previous Elasticsearch node version , for instance between 6.1 and 6.0, in case the 6.1 client supports new request body fields for some APIs that are not known by the 6.0 node(s). 6.0客户端可以与任何6.x Elasticsearch节点进行通信,而6.1客户端可以与6.1、6.2和任何更高版本的6.x版本进行通信, 但是与先前的Elasticsearch节点进行通信时可能会出现不兼容问题如果6.1客户端支持6.0节点不知道的某些API的新请求正文字段,则版本介于6.1和6.0之间。

In other words, the Java Rest Client should never be newer than the Elasticsearch node. 换句话说,Java Rest Client应该永远不会比Elasticsearch节点新。

For your case, it strongly advised that you should either upgrade Elastic Search to 6.5 as well or downgrade your Java Rest Client back to 6.3. 对于您的情况,强烈建议您也将Elastic Search升级到6.5或将Java Rest Client降级到6.3。

Updated By Query is available in 6.3 as well so I don't see why you need to use version 6.5 of the Java Rest Client. 6.3中还提供了“按查询更新”功能,因此我看不到为什么需要使用Java Rest Client 6.5版。 Unless there is some new features within the Updated By Query API that is released in 6.5 which I'm unaware. 除非我不知道6.5中发布的“按查询更新的API”中有一些新功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以用较新的JDK用ant编译Java较旧版本的Java,以便在编译使用较新API的代码时生成输出吗? - Can i compile java for an older Java version with ant with a newer JDK so it generates output when it compiles code that uses the newer API? 如何让rJava在osx上使用更新版本的java? - How can I make rJava use the newer version of java on osx? Elasticsearch High level Java Client 6.0.1 实现基于脚本的排序 - Elasticsearch High level Java Client version 6.0.1 to implement script based sorting Elasticsearch高级Rest Client Java排序不正常 - Elasticsearch High Level Rest Client Java sorting not working properly ElasticSearch 多词查询与 Java 高级 REST 客户端 - ElasticSearch Multi Term Query With Java High-Level REST Client ElasticSearch Java高级Rest客户端:建议搜索 - ElasticSearch Java high Level Rest Client: Suggest-search ElasticSearch Java 高级 REST 客户端:过滤文档和或查询 - ElasticSearch Java High Level REST Client: filter documents and or query ElasticSearch Rest 高级客户端重新映射错误 - ElasticSearch Rest High Level Client remapping wrong 是否可以编译较新的Java版本(9,10,11)以在较旧的平台(例如Java 8)上运行? - Can newer Java version (9, 10, 11) be compiled to run on older platforms (e.g Java 8)? 弹性 - 使用 Java 高级 Rest 客户端执行字符串查询 - Elastic - Use Java High Level Rest Client To Perform a String Query
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM