You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the changes in version 4.0.x is that Spring Data Elasticsearch does not use the Jackson Mapper anymore to map an entity to the JSON representation needed for Elasticsearch (see <<elasticsearch.mapping>>). In version 3.2.x the Jackson Mapper was the default that was used. It was possible to switch to the meta-model based converter (named `ElasticsearchEntityMapper`) by explicitly configuring it (<<elasticsearch.mapping.meta-model>>).
10
10
11
11
In version 4.0.x the meta-model based converter is the only one that is available and does not need to be configured explicitly. If you had a custom configuration to enable the meta-model converter by providing a bean like this:
12
12
13
-
[code,java]
13
+
[source,java]
14
14
----
15
15
@Bean
16
16
@Override
17
-
public EntityMapper entityMapper() {
17
+
public EntityMapper entityMapper() {
18
18
19
19
ElasticsearchEntityMapper entityMapper = new ElasticsearchEntityMapper(
20
-
elasticsearchMappingContext(), new DefaultConversionService()
20
+
elasticsearchMappingContext(), new DefaultConversionService()
@@ -30,15 +30,15 @@ You now have to remove this bean, the `ElasticsearchEntityMapper` interface has
30
30
.Entity configuration
31
31
Some users had custom Jackson annotations on the entity class, for example in order to define a custom name for the mapped document in Elasticsearch or to configure date conversions. These are not taken into account anymore. The needed functionality is now provided with Spring Data Elasticsearch's `@Field` annotation. Please see <<elasticsearch.mapping.meta-model.annotations>> for detailed information.
32
32
33
-
34
-
=== Removal of implicit index name from query objects
== Removal of implicit index name from query objects
35
35
36
36
In 3.2.x the different query classes like `IndexQuery` or `SearchQuery` had properties that were taking the index name or index names that they were operating upon. If these were not set, the passed in entity was inspected to retrieve the index name that was set in the `@Document` annotation. +
37
37
In 4.0.x the index name(s) must now be provided in an additional parameter of type `IndexCoordinates`. By separating this, it now is possible to use one query object against different indices.
To make it easier to work with entities and use the index name that is contained in the entitie's `@Document` annotation, new methods have been added like `DocumentOperations.save(T entity)`;
In version 3.2 there was the `ElasticsearchOperations` interface that defined all the methods for the `ElasticsearchTemplate` class. In version 4 the functions have been split into different interfaces, aligning these interfaces with the Elasticsearch API:
71
71
@@ -77,10 +77,10 @@ In version 3.2 there was the `ElasticsearchOperations` interface that defined al
77
77
78
78
NOTE: All the functions from the `ElasticsearchOperations` interface in version 3.2 that are now moved to the `IndexOperations` interface are still available, they are marked as deprecated and have default implementations that delegate to the new implementation:
79
79
80
-
[code,java]
80
+
[source,java]
81
81
----
82
82
/**
83
-
* Create an index for given indexName.
83
+
* Create an index for given indexName.
84
84
*
85
85
* @param indexName the name of the index
86
86
* @return {@literal true} if the index was created
Many functions and classes have been deprecated. These functions still work, but the Javadocs show with what they should be replaced.
101
101
102
102
.Example from ElasticsearchOperations
103
-
[code,java]
103
+
[source,java]
104
104
----
105
-
/**
105
+
/*
106
106
* Retrieves an object from an index.
107
107
*
108
108
* @param query the query defining the id of the object to get
@@ -113,15 +113,16 @@ Many functions and classes have been deprecated. These functions still work, but
113
113
@Deprecated
114
114
@Nullable
115
115
<T> T queryForObject(GetQuery query, Class<T> clazz);
116
-
----
116
+
----
117
117
118
-
==== Elasticsearch deprecations
118
+
=== Elasticsearch deprecations
119
119
120
120
Since version 7 the Elasticsearch `TransportClient` is deprecated, it will be removed with Elasticsearch version 8. Spring Data Elasticsearch deprecates the `ElasticsearchTemplate` class which uses the `TransportClient` in version 4.0.
121
121
122
122
Mapping types were removed from Elasticsearch 7, they still exist as deprecated values in the Spring Data `@Document` annotation and the `IndexCoordinates` class but they are not used anymore internally.
123
123
124
-
=== Removals
124
+
[[elasticsearch-migration-guide-3.2-4.0.removal]]
125
+
== Removals
125
126
126
127
* As already described, the `ElasticsearchEntityMapper` interface has been removed.
127
128
@@ -130,4 +131,3 @@ Mapping types were removed from Elasticsearch 7, they still exist as deprecated
130
131
* The method `org.springframework.data.elasticsearch.core.ElasticsearchOperations.query(SearchQuery query, ResultsExtractor<T> resultsExtractor);` and the `org.springframework.data.elasticsearch.core.ResultsExtractor` interface have been removed. These could be used to parse the result from Elasticsearch for cases in which the response mapping done with the Jackson based mapper was not enough. Since version 4.0, there are the new <<elasticsearch.operations.searchresulttypes>> to return the information from an Elasticsearch response, so there is no need to expose this low level functionality.
131
132
132
133
* The low level methods `startScroll`, `continueScroll` and `clearScroll` have been removed from the `ElasticsearchOperations` interface. For low level scroll API access, there now are `searchScrollStart`, `searchScrollContinue` and `searchScrollClear` methods on the `ElasticsearchRestTemplate` class.
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.
5
5
6
-
=== Removals
6
+
[[elasticsearch-migration-guide-4.0-4.1.removal]]
7
+
== Removals
7
8
8
9
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.
0 commit comments