Upgrading from 5.0.x to 5.1.x
本节描述了从版本 5.0.x 到 5.1.x 的重大更改,以及如何通过新引入的功能替换已删除的功能。
This section describes breaking changes from version 5.0.x to 5.1.x and how removed features can be replaced by new introduced features.
Breaking Changes
在 org.springframework.data.elasticsearch.core.index.AliasData
类中,该类用于处理从 Elasticsearch 返回别名信息,类型为 Document
的属性 filter
已被类型为`org.springframework.data.elasticsearch.core.query.Query` 的 filterQuery
替换。
In the org.springframework.data.elasticsearch.core.index.AliasData
class, which is used for alias information returned from Elasticsearch, the property filter
(of type Document
) is replaced by filterQuery
which is of type
org.springframework.data.elasticsearch.core.query.Query
.
org.springframework.data.elasticsearch.annotations.Similarity
直到 5.1 才一直是一个枚举类。此枚举在 @Field
注释中用于指定相似度值。但是除了枚举定义的值之外,Elasticsearch 中还可以使用具有自定义名称的相似项。因此,注释属性已从枚举类型更改为一个简单的 String
。之前的枚举值(如 Similarity.Default
)仍以 String 常量的形式存在,因此现有代码将在未修改的情况下进行编译。当在 @Field
注释的属性之外使用此枚举时,需要进行调整。
org.springframework.data.elasticsearch.annotations.Similarity
was an enum class until 5.1. This enum was used in the @Field
annotation to specify a similarity value.
But besides the values defined by the enum, it is possible to have similarities with custom names in Elasticsearch.
Therefore, the annotation property was changed from the type of the enum to a simple String
.
The previous enum values like Similarity.Default
do still exist as String constants, so existing code will compile unmodified.
Adaptions are necessary when this enum was used at other places than as a property of the @Field
annotation.
Deprecations
template functions
Spring Data Elasticsearch 4.1 中引入的用于管理索引模板的 IndexOperations
和 ReactiverIndexOperations
中的函数已弃用。它们使用的是 Elasticsearch 版本 7.8 中已弃用的旧 Elasticsearch API。
The functions in the IndexOperations
and ReactiverIndexOperations
to manage index templates that were introduced in Spring Data Elasticsearch 4.1
have been deprecated. They were using the old Elasticsearch API that was deprecated in Elasticsearch version 7.8.
请改用基于可组合索引模板 API 的新函数。
Please use the new functions that are based on the composable index template API instead.