从 5.1.x 升级到 5.2.x

本节介绍从 5.1.x 到 5.2.x 版本的重大更改,以及如何用新引入的功能替换已删除的功能。

重大更改

批量操作失败

org.springframework.data.elasticsearch.BulkFailureException 类中,getFailedDocuments 的返回类型已从 Map<String, String> 更改为 Map<String, FailureDetails>,这允许获取有关失败原因的额外详细信息。

FailureDetails 类(BulkFailureException 的内部类)的定义

public record FailureDetails(Integer status, String errorMessage) {
}

脚本字段和运行时字段

org.springframework.data.elasticsearch.core.RuntimeFieldorg.springframework.data.elasticsearch.core.query.ScriptType 已移至子包 org.springframework.data.elasticsearch.core.query

ScriptData 构造函数的 type 参数不再可为空。

弃用

删除已弃用代码

  • 所有使用旧的已弃用的 RestHighLevelClient 的代码都已删除。自 5.0 版本以来,默认的 Elasticsearch 客户端是(不再那么新的)Elasticsearch Java 客户端。

  • org.springframework.data.elasticsearch.client.ClientLogger 类已删除。此日志记录器配置了 org.springframework.data.elasticsearch.client.WIRE 设置,但并非适用于所有客户端。从 5 版本开始,请使用 Elasticsearch Java 客户端中提供的跟踪日志记录器,请参阅 客户端日志记录

  • 方法 org.springframework.data.elasticsearch.core.ElasticsearchOperations.stringIdRepresentation(Object) 已删除,请改用在同一接口中定义的 convertId(Object) 方法。

  • org.springframework.data.elasticsearch.core.Range 已删除,请改用 org.springframework.data.domain.Range

  • 方法 org.springframework.data.elasticsearch.core.query.IndexQuery.getParentId()setParentId(String) 已删除,它们不再使用且是空操作。它也已从 org.springframework.data.elasticsearch.core.query.IndexQuery 类中删除。

© . This site is unofficial and not affiliated with VMware.