[英]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.