Upgrading from 5.1.x to 5.2.x
本节描述了从版本 5.1.x 到 5.2.x 的重大更改,以及如何通过新引入的功能替换已删除的功能。
This section describes breaking changes from version 5.1.x to 5.2.x and how removed features can be replaced by new introduced features.
Breaking Changes
Bulk failures
在 org.springframework.data.elasticsearch.BulkFailureException
类中,getFailedDocuments
的返回类型从 Map<String, String>
更改为 Map<String, FailureDetails>
, 这允许获取有关失败原因的更多详细信息。
In the org.springframework.data.elasticsearch.BulkFailureException
class, the return type of the getFailedDocuments
is changed from Map<String, String>
to Map<String, FailureDetails>
, which allows to get additional details about failure reasons.
FailureDetails
类的定义(BulkFailureException
的内部类):
The definition of the FailureDetails
class (inner to BulkFailureException
):
public record FailureDetails(Integer status, String errorMessage) {
}
scripted and runtime fields
org.springframework.data.elasticsearch.core.RuntimeField
和 org.springframework.data.elasticsearch.core.query.ScriptType
类已移至子包 org.springframework.data.elasticsearch.core.query
。
The classes org.springframework.data.elasticsearch.core.RuntimeField
and org.springframework.data.elasticsearch.core.query.ScriptType
have been moved to the subpackage org.springframework.data.elasticsearch.core.query
.
ScriptData
构造函数的 type
参数已不再为可空。
The type
parameter of the ScriptData
constructor is not nullable any longer.
Deprecations
Removal of deprecated code
-
All the code using the old deprecated
RestHighLevelClient
has been removed. The default Elasticsearch client used since version 5.0 is the (not so) new Elasticsearch Java client. -
The
org.springframework.data.elasticsearch.client.ClientLogger
class has been removed. This logger was configured with theorg.springframework.data.elasticsearch.client.WIRE
setting, but was not working with all clients. From version 5 on, use the trace logger available in the Elasticsearch Java client, see Client Logging. -
The method
org.springframework.data.elasticsearch.core.ElasticsearchOperations.stringIdRepresentation(Object)
has been removed, use theconvertId(Object)
method defined in the same interface instead. -
The class
org.springframework.data.elasticsearch.core.Range
has been removed, useorg.springframework.data.domain.Range
instead. -
The methods
org.springframework.data.elasticsearch.core.query.IndexQuery.getParentId() and `setParentId(String)
have been removed, they weren’t used anymore and were no-ops. It has been removed from theorg.springframework.data.elasticsearch.core.query.IndexQuery
class as well.