This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Data Elasticsearch 5.4.0! |
Upgrading from 4.2.x to 4.3.x
This section describes breaking changes from version 4.2.x to 4.3.x and how removed features can be replaced by new introduced features.
Elasticsearch is working on a new Client that will replace the Spring Data Elasticsearch also removes or replaces the use of classes from the Places where classes are used that cannot easily be replaced, this usage is marked as deprecated, we are working on replacements. Check the sections on Deprecations and Breaking Changes for further details. |
Deprecations
suggest methods
In SearchOperations
, and so in ElasticsearchOperations
as well, the suggest
methods taking a org.elasticsearch.search.suggest.SuggestBuilder
as argument and returning a org.elasticsearch.action.search.SearchResponse
have been deprecated.
Use SearchHits<T> search(Query query, Class<T> clazz)
instead, passing in a NativeSearchQuery
which can contain a SuggestBuilder
and read the suggest results from the returned SearchHit<T>
.
In ReactiveSearchOperations
the new suggest
methods return a Mono<org.springframework.data.elasticsearch.core.suggest.response.Suggest>
now.
Here as well the old methods are deprecated.
Breaking Changes
Removal of org.elasticsearch
classes from the API.
-
In the
org.springframework.data.elasticsearch.annotations.CompletionContext
annotation the propertytype()
has changed fromorg.elasticsearch.search.suggest.completion.context.ContextMapping.Type
toorg.springframework.data.elasticsearch.annotations.CompletionContext.ContextMappingType
, the available enum values are the same. -
In the
org.springframework.data.elasticsearch.annotations.Document
annotation theversionType()
property has changed toorg.springframework.data.elasticsearch.annotations.Document.VersionType
, the available enum values are the same. -
In the
org.springframework.data.elasticsearch.core.query.Query
interface thesearchType()
property has changed toorg.springframework.data.elasticsearch.core.query.Query.SearchType
, the available enum values are the same. -
In the
org.springframework.data.elasticsearch.core.query.Query
interface the return value oftimeout()
was changed tojava.time.Duration
. -
The
SearchHits<T>`class does not contain the `org.elasticsearch.search.aggregations.Aggregations
anymore. Instead it now contains an instance of theorg.springframework.data.elasticsearch.core.AggregationsContainer<T>
class whereT
is the concrete aggregations type from the underlying client that is used. Currently this will be aorg .springframework.data.elasticsearch.core.clients.elasticsearch7.ElasticsearchAggregations
object; later different implementations will be available. The same change has been done to theReactiveSearchOperations.aggregate()
functions, the now return aFlux<AggregationContainer<?>>
. Programs using the aggregations need to be changed to cast the returned value to the appropriate class to further proces it. -
methods that might have thrown a
org.elasticsearch.ElasticsearchStatusException
now will throworg.springframework.data.elasticsearch.RestStatusException
instead.
Handling of field and sourceFilter properties of Query
Up to version 4.2 the fields
property of a Query
was interpreted and added to the include list of the sourceFilter
.
This was not correct, as these are different things for Elasticsearch.
This has been corrected.
As a consequence code might not work anymore that relies on using fields
to specify which fields should be returned from the document’s _source' and should be changed to use the `sourceFilter
.
search_type default value
The default value for the search_type
in Elasticsearch is query_then_fetch
.
This now is also set as default value in the Query
implementations, it was previously set to dfs_query_then_fetch
.
BulkOptions changes
Some properties of the org.springframework.data.elasticsearch.core.query.BulkOptions
class have changed their type:
-
the type of the
timeout
property has been changed tojava.time.Duration
. -
the type of the`refreshPolicy` property has been changed to
org.springframework.data.elasticsearch.core.RefreshPolicy
.
IndicesOptions change
Spring Data Elasticsearch now uses org.springframework.data.elasticsearch.core.query.IndicesOptions
instead of org.elasticsearch.action.support.IndicesOptions
.
Completion classes
The classes from the package org.springframework.data.elasticsearch.core.completion
have been moved to org.springframework.data.elasticsearch.core.suggest
.
Other renamings
The org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentPropertyConverter
interface has been renamed to org.springframework.data.elasticsearch.core.mapping.PropertyValueConverter
.
Likewise the implementations classes named XXPersistentPropertyConverter have been renamed to XXPropertyValueConverter.