從 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.