Skip to content

Commit e8edd60

Browse files
authored
Cleanup deprecations from 4.0. (#1671)
Original Pull Request #1671 Closes #1669
1 parent 4829b07 commit e8edd60

File tree

53 files changed

+149
-2045
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+149
-2045
lines changed

src/main/asciidoc/reference/elasticsearch-migration-guide-4.1-4.2.adoc

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,41 @@ This section describes breaking changes from version 4.1.x to 4.2.x and how remo
99
[[elasticsearch-migration-guide-4.1-4.2.removal]]
1010
== Removals
1111

12+
The `@Score` annotation that was used to set the score return value in an entity was deprecated in version 4.0 and has been removed.
13+
Scroe values are returned in the `SearchHit` instances that encapsulate the returned entities.
14+
15+
The `org.springframework.data.elasticsearch.ElasticsearchException` class has been removed.
16+
The remaining usages have been replaced with `org.springframework.data.mapping.MappingException` and `org.springframework.dao.InvalidDataAccessApiUsageException`.
17+
18+
The deprecated `ScoredPage`, `ScrolledPage` `@AggregatedPage` and implementations has been removed.
19+
20+
The deprecated `GetQuery` and `DeleteQuery` have been removed.
21+
22+
The deprecated `find` methods from `ReactiveSearchOperations` and `ReactiveDocumentOperations` have been removed.
23+
1224
[[elasticsearch-migration-guide-4.1-4.2.breaking-changes]]
1325
== Breaking Changes
1426

1527
=== RefreshPolicy
1628

1729
==== Enum package changed
1830

19-
It was possible in 4.1 to configure the refresh policy for the `ReactiveElasticsearchTemplate` by overriding the method `AbstractReactiveElasticsearchConfiguration.refreshPolicy()` in a custom configuration class. The return value of this method was an instance of the class `org.elasticsearch.action.support.WriteRequest.RefreshPolicy`.
31+
It was possible in 4.1 to configure the refresh policy for the `ReactiveElasticsearchTemplate` by overriding the method `AbstractReactiveElasticsearchConfiguration.refreshPolicy()` in a custom configuration class.
32+
The return value of this method was an instance of the class `org.elasticsearch.action.support.WriteRequest.RefreshPolicy`.
2033

21-
Now the configuration must return `org.springframework.data.elasticsearch.core.RefreshPolicy`. This enum has the same values and triggers the same behaviour as before, so only the `import` statement has to be adjusted.
34+
Now the configuration must return `org.springframework.data.elasticsearch.core.RefreshPolicy`.
35+
This enum has the same values and triggers the same behaviour as before, so only the `import` statement has to be adjusted.
2236

2337
==== Refresh behaviour
2438

25-
`ElasticsearchOperations` and `ReactiveElasticsearchOperations` now explicitly use the `RefreshPolicy` set on the template for write requests if not null. If the refresh policy is null, then nothing special is done, so the cluster defaults are used. `ElasticsearchOperations` was always using the cluster default before this version.
39+
`ElasticsearchOperations` and `ReactiveElasticsearchOperations` now explicitly use the `RefreshPolicy` set on the template for write requests if not null.
40+
If the refresh policy is null, then nothing special is done, so the cluster defaults are used. `ElasticsearchOperations` was always using the cluster default before this version.
2641

27-
The provided implementations for `ElasticsearchRepository` and `ReactiveElasticsearchRepository` will do an explicit refresh when the refresh policy is null. This is the same behaviour as in previous versions. If a refresh policy is set, then it will be used by the repositories as well.
42+
The provided implementations for `ElasticsearchRepository` and `ReactiveElasticsearchRepository` will do an explicit refresh when the refresh policy is null.
43+
This is the same behaviour as in previous versions.
44+
If a refresh policy is set, then it will be used by the repositories as well.
2845

2946
==== Refresh configuration
3047

31-
When configuring Spring Data Elasticsearch like described in <<elasticsearch.clients>> by using `ElasticsearchConfigurationSupport`, `AbstractElasticsearchConfiguration` or `AbstractReactiveElasticsearchConfiguration` the refresh policy will be initialized to `null`. Previously the reactive code initialized this to `IMMEDIATE`, now reactive and
32-
non-reactive code show the same behaviour.
48+
When configuring Spring Data Elasticsearch like described in <<elasticsearch.clients>> by using `ElasticsearchConfigurationSupport`, `AbstractElasticsearchConfiguration` or `AbstractReactiveElasticsearchConfiguration` the refresh policy will be initialized to `null`.
49+
Previously the reactive code initialized this to `IMMEDIATE`, now reactive and non-reactive code show the same behaviour.

src/main/java/org/springframework/data/elasticsearch/ElasticsearchException.java

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/main/java/org/springframework/data/elasticsearch/annotations/Score.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/main/java/org/springframework/data/elasticsearch/core/AbstractElasticsearchTemplate.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
5454
import org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext;
5555
import org.springframework.data.elasticsearch.core.query.BulkOptions;
56-
import org.springframework.data.elasticsearch.core.query.GetQuery;
5756
import org.springframework.data.elasticsearch.core.query.IndexQuery;
5857
import org.springframework.data.elasticsearch.core.query.IndexQueryBuilder;
5958
import org.springframework.data.elasticsearch.core.query.MoreLikeThisQuery;
@@ -249,23 +248,11 @@ public <T> T get(String id, Class<T> clazz) {
249248
return get(id, clazz, getIndexCoordinatesFor(clazz));
250249
}
251250

252-
@Override
253-
@Nullable
254-
public <T> T get(GetQuery query, Class<T> clazz, IndexCoordinates index) {
255-
return get(query.getId(), clazz, index);
256-
}
257-
258251
@Override
259252
public <T> List<T> multiGet(Query query, Class<T> clazz) {
260253
return multiGet(query, clazz, getIndexCoordinatesFor(clazz));
261254
}
262255

263-
@Override
264-
@Nullable
265-
public <T> T queryForObject(GetQuery query, Class<T> clazz) {
266-
return get(query.getId(), clazz, getIndexCoordinatesFor(clazz));
267-
}
268-
269256
@Override
270257
public boolean exists(String id, Class<?> clazz) {
271258
return exists(id, getIndexCoordinatesFor(clazz));
@@ -400,11 +387,6 @@ public long count(Query query, Class<?> clazz) {
400387
return count(query, clazz, getIndexCoordinatesFor(clazz));
401388
}
402389

403-
@Override
404-
public <T> CloseableIterator<T> stream(Query query, Class<T> clazz, IndexCoordinates index) {
405-
return (CloseableIterator<T>) SearchHitSupport.unwrapSearchHits(searchForStream(query, clazz, index));
406-
}
407-
408390
@Override
409391
public <T> SearchHitsIterator<T> searchForStream(Query query, Class<T> clazz) {
410392
return searchForStream(query, clazz, getIndexCoordinatesFor(clazz));

src/main/java/org/springframework/data/elasticsearch/core/DocumentOperations.java

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
2121
import org.springframework.data.elasticsearch.core.query.BulkOptions;
22-
import org.springframework.data.elasticsearch.core.query.DeleteQuery;
23-
import org.springframework.data.elasticsearch.core.query.GetQuery;
2422
import org.springframework.data.elasticsearch.core.query.IndexQuery;
2523
import org.springframework.data.elasticsearch.core.query.Query;
2624
import org.springframework.data.elasticsearch.core.query.UpdateByQueryResponse;
@@ -310,41 +308,4 @@ default void bulkUpdate(List<UpdateQuery> queries, IndexCoordinates index) {
310308
* @since 4.2
311309
*/
312310
UpdateByQueryResponse updateByQuery(UpdateQuery updateQuery, IndexCoordinates index);
313-
314-
// region deprecated
315-
/**
316-
* Delete all records matching the query.
317-
*
318-
* @param query query defining the objects
319-
* @param index the index where to delete the records
320-
* @deprecated since 4.0, use {@link #delete(Query, Class, IndexCoordinates)}
321-
*/
322-
@Deprecated
323-
void delete(DeleteQuery query, IndexCoordinates index);
324-
325-
/**
326-
* Retrieves an object from an index.
327-
*
328-
* @param query the query defining the id of the object to get
329-
* @param clazz the type of the object to be returned
330-
* @param index the index from which the object is read.
331-
* @return the found object
332-
* @deprecated since 4.0, use {@link #get(String, Class, IndexCoordinates)}
333-
*/
334-
@Deprecated
335-
@Nullable
336-
<T> T get(GetQuery query, Class<T> clazz, IndexCoordinates index);
337-
338-
/**
339-
* Retrieves an object from an index.
340-
*
341-
* @param query the query defining the id of the object to get
342-
* @param clazz the type of the object to be returned
343-
* @return the found object
344-
* @deprecated since 4.0, use {@link #get(String, Class, IndexCoordinates)}
345-
*/
346-
@Deprecated
347-
@Nullable
348-
<T> T queryForObject(GetQuery query, Class<T> clazz);
349-
// endregion
350311
}

0 commit comments

Comments
 (0)