從 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 之前是一個列舉類。此列舉用於 @Field 註解中以指定相似度值。但除了列舉定義的值之外,Elasticsearch 中還可以有自定義名稱的相似度。因此,註解屬性的型別從列舉型別更改為簡單的 String。以前的列舉值,例如 Similarity.Default,仍然作為字串常量存在,因此現有程式碼將無需修改即可編譯。當此列舉在 @Field 註解的屬性以外的其他地方使用時,需要進行調整。