Upgrading from 4.0.x to 4.1.x

本节描述了从版本 4.0.x 到 4.1.x 的重大更改,以及如何通过新引入的功能替换已删除的功能。

This section describes breaking changes from version 4.0.x to 4.1.x and how removed features can be replaced by new introduced features.

Deprecations

Definition of the id property

可以通过将其命名为 iddocument 将实体属性定义为 id 属性。此行为现已弃用并会产生警告。请使用 @Id 注释将属性标记为 id 属性。

Definition of the id property

It is possible to define a property of en entity as the id property by naming it either id or document. This behaviour is now deprecated and will produce a warning. Please use the @Id annotation to mark a property as being the id property.

Index mappings

ReactiveElasticsearchClient.Indices 接口中,updateMapping 方法已被弃用,取而代之的是 putMapping 方法。它们执行相同的功能,但 putMapping 与 Elasticsearch API 中的命名一致:

Index mappings

In the ReactiveElasticsearchClient.Indices interface the updateMapping methods are deprecated in favour of the putMapping methods. They do the same, but putMapping is consistent with the naming in the Elasticsearch API:

Alias handling

IndexOperations 接口中,addAlias(AliasQuery)removeAlias(AliasQuery)queryForAlias() 方法已弃用。新方法 alias(AliasAction)getAliases(String…​)getAliasesForIndex(String…​) 提供了更多功能和更简洁的 API。

Alias handling

In the IndexOperations interface the methods addAlias(AliasQuery), removeAlias(AliasQuery) and queryForAlias() have been deprecated. The new methods alias(AliasAction), getAliases(String…​) and getAliasesForIndex(String…​) offer more functionality and a cleaner API.

Parent-ID

自版本 6 起,已从 Elasticsearch 中删除父 ID 的使用。我们现在弃用相应的字段和方法。

Parent-ID

Usage of a parent-id has been removed from Elasticsearch since version 6. We now deprecate the corresponding fields and methods.

Removals

Type mappings

@Document 注释和 IndexCoordinates 对象的 类型映射 参数已删除。它们在 Spring Data Elasticsearch 4.0 中已被弃用,其值不再使用。

Type mappings

The type mappings parameters of the @Document annotation and the IndexCoordinates object were removed. They had been deprecated in Spring Data Elasticsearch 4.0 and their values weren’t used anymore.

Breaking Changes

Return types of ReactiveElasticsearchClient.Indices methods

ReactiveElasticsearchClient.Indices 中的方法到目前为止尚未使用。随着 ReactiveIndexOperations 的引入,有必要更改一些返回类型:

The methods in the ReactiveElasticsearchClient.Indices were not used up to now. With the introduction of the ReactiveIndexOperations it became necessary to change some of the return types:

  • the createIndex variants now return a Mono<Boolean> instead of a Mono<Void> to signal successful index creation.

  • the updateMapping variants now return a Mono<Boolean> instead of a Mono<Void> to signal successful mappings storage.

Return types of DocumentOperations.bulkIndex methods

这些方法返回一个包含新索引记录 ID 的 List<String>。现在它们返回一个 List<IndexedObjectInformation>;这些对象包含 ID 和有关乐观锁定的信息(seq_no 和 primary_term)

These methods were returning a List<String> containing the ids of the new indexed records. Now they return a List<IndexedObjectInformation>; these objects contain the id and information about optimistic locking (seq_no and primary_term)