從 5.0.x 升級到 5.1.x

本節描述從 5.0.x 版本到 5.1.x 版本的重大變更,以及如何使用新引入的功能來取代已移除的功能。

重大變更

在 `org.springframework.data.elasticsearch.core.index.AliasData` 類別中 (用於從 Elasticsearch 傳回的別名資訊),屬性 `filter` (類型為 `Document`) 已被 `filterQuery` 取代,後者的類型為 `org.springframework.data.elasticsearch.core.query.Query`。

`org.springframework.data.elasticsearch.annotations.Similarity` 在 5.1 版本之前是一個 enum 類別。此 enum 用於 `@Field` 註解中,以指定相似度值。但是,除了 enum 定義的值之外,Elasticsearch 中還可以有具有自訂名稱的相似度。因此,註解屬性的類型已從 enum 類型變更為簡單的 `String`。先前的 enum 值 (例如 `Similarity.Default`) 仍然以 String 常數的形式存在,因此現有程式碼將可以未經修改地編譯。當此 enum 用於 `@Field` 註解的屬性以外的其他位置時,則需要進行調整。

棄用

範本函式

在 Spring Data Elasticsearch 4.1 中引入的 `IndexOperations` 和 `ReactiverIndexOperations` 中用於管理索引範本的函式已被棄用。它們使用的是舊的 Elasticsearch API,該 API 已在 Elasticsearch 7.8 版本中棄用。

請改用基於可組合索引範本 API 的新函式。