Skip to content

Commit fa97924

Browse files
authored
Remove deprecated methods.
Original Pull Request #3067 Closes #3066 Signed-off-by: Peter-Josef Meisch <[email protected]>
1 parent 8b43af2 commit fa97924

File tree

8 files changed

+9
-85
lines changed

8 files changed

+9
-85
lines changed

src/main/antora/modules/ROOT/pages/migration-guides/migration-guide-5.4-5.5.adoc

+8
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,11 @@ Some classes that probably are not used by a library user have been renamed, the
2020
|===
2121

2222
=== Removals
23+
24+
The following methods that had been deprecated since release 5.3 have been removed:
25+
```
26+
DocumentOperations.delete(Query, Class<?>)
27+
DocumentOperations.delete(Query, Class<?>, IndexCoordinates)
28+
ReactiveDocumentOperations.delete(Query, Class<?>)
29+
ReactiveDocumentOperations.delete(Query, Class<?>, IndexCoordinates)
30+
```

src/main/java/org/springframework/data/elasticsearch/client/elc/ElasticsearchTemplate.java

-13
Original file line numberDiff line numberDiff line change
@@ -181,19 +181,6 @@ public ByQueryResponse delete(DeleteQuery query, Class<?> clazz) {
181181
return delete(query, clazz, getIndexCoordinatesFor(clazz));
182182
}
183183

184-
@Override
185-
public ByQueryResponse delete(Query query, Class<?> clazz, IndexCoordinates index) {
186-
187-
Assert.notNull(query, "query must not be null");
188-
189-
DeleteByQueryRequest request = requestConverter.documentDeleteByQueryRequest(query, routingResolver.getRouting(),
190-
clazz, index, getRefreshPolicy());
191-
192-
DeleteByQueryResponse response = execute(client -> client.deleteByQuery(request));
193-
194-
return responseConverter.byQueryResponse(response);
195-
}
196-
197184
@Override
198185
public ByQueryResponse delete(DeleteQuery query, Class<?> clazz, IndexCoordinates index) {
199186
Assert.notNull(query, "query must not be null");

src/main/java/org/springframework/data/elasticsearch/client/elc/ReactiveElasticsearchTemplate.java

-10
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,6 @@ protected Mono<Boolean> doExists(String id, IndexCoordinates index) {
167167
.onErrorReturn(NoSuchIndexException.class, false);
168168
}
169169

170-
@Override
171-
public Mono<ByQueryResponse> delete(Query query, Class<?> entityType, IndexCoordinates index) {
172-
173-
Assert.notNull(query, "query must not be null");
174-
175-
DeleteByQueryRequest request = requestConverter.documentDeleteByQueryRequest(query, routingResolver.getRouting(),
176-
entityType, index, getRefreshPolicy());
177-
return Mono.from(execute(client -> client.deleteByQuery(request))).map(responseConverter::byQueryResponse);
178-
}
179-
180170
@Override
181171
public Mono<ByQueryResponse> delete(DeleteQuery query, Class<?> entityType, IndexCoordinates index) {
182172
Assert.notNull(query, "query must not be null");

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

-6
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,6 @@ public String delete(String id, Class<?> entityType) {
298298
return this.delete(id, getIndexCoordinatesFor(entityType));
299299
}
300300

301-
@Override
302-
@Deprecated
303-
public ByQueryResponse delete(Query query, Class<?> clazz) {
304-
return delete(query, clazz, getIndexCoordinatesFor(clazz));
305-
}
306-
307301
@Override
308302
public String delete(Object entity) {
309303
return delete(entity, getIndexCoordinatesFor(entity.getClass()));

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

-6
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,6 @@ public Mono<String> delete(String id, IndexCoordinates index) {
408408

409409
abstract protected Mono<String> doDeleteById(String id, @Nullable String routing, IndexCoordinates index);
410410

411-
@Override
412-
@Deprecated
413-
public Mono<ByQueryResponse> delete(Query query, Class<?> entityType) {
414-
return delete(query, entityType, getIndexCoordinatesFor(entityType));
415-
}
416-
417411
@Override
418412
public Mono<ByQueryResponse> delete(DeleteQuery query, Class<?> entityType) {
419413
return delete(query, entityType, getIndexCoordinatesFor(entityType));

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

-26
Original file line numberDiff line numberDiff line change
@@ -272,19 +272,6 @@ default void bulkUpdate(List<UpdateQuery> queries, IndexCoordinates index) {
272272
*/
273273
String delete(Object entity, IndexCoordinates index);
274274

275-
/**
276-
* Delete all records matching the query.
277-
*
278-
* @param query query defining the objects
279-
* @param clazz The entity class, must be annotated with
280-
* {@link org.springframework.data.elasticsearch.annotations.Document}
281-
* @return response with detailed information
282-
* @since 4.1
283-
* @deprecated since 5.3.0, use {@link #delete(DeleteQuery, Class)}
284-
*/
285-
@Deprecated
286-
ByQueryResponse delete(Query query, Class<?> clazz);
287-
288275
/**
289276
* Delete all records matching the query.
290277
*
@@ -296,19 +283,6 @@ default void bulkUpdate(List<UpdateQuery> queries, IndexCoordinates index) {
296283
*/
297284
ByQueryResponse delete(DeleteQuery query, Class<?> clazz);
298285

299-
/**
300-
* Delete all records matching the query.
301-
*
302-
* @param query query defining the objects
303-
* @param clazz The entity class, must be annotated with
304-
* {@link org.springframework.data.elasticsearch.annotations.Document}
305-
* @param index the index from which to delete
306-
* @return response with detailed information
307-
* @deprecated since 5.3.0, use {@link #delete(DeleteQuery, Class, IndexCoordinates)}
308-
*/
309-
@Deprecated
310-
ByQueryResponse delete(Query query, Class<?> clazz, IndexCoordinates index);
311-
312286
/**
313287
* Delete all records matching the query.
314288
*

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

-23
Original file line numberDiff line numberDiff line change
@@ -326,17 +326,6 @@ default Mono<Void> bulkUpdate(List<UpdateQuery> queries, IndexCoordinates index)
326326
*/
327327
Mono<String> delete(String id, Class<?> entityType);
328328

329-
/**
330-
* Delete the documents matching the given {@link Query} extracting index from entity metadata.
331-
*
332-
* @param query must not be {@literal null}.
333-
* @param entityType must not be {@literal null}.
334-
* @return a {@link Mono} emitting the number of the removed documents.
335-
* @deprecated since 5.3.0, use {@link #delete(DeleteQuery, Class)}
336-
*/
337-
@Deprecated
338-
Mono<ByQueryResponse> delete(Query query, Class<?> entityType);
339-
340329
/**
341330
* Delete the documents matching the given {@link Query} extracting index from entity metadata.
342331
*
@@ -347,18 +336,6 @@ default Mono<Void> bulkUpdate(List<UpdateQuery> queries, IndexCoordinates index)
347336
*/
348337
Mono<ByQueryResponse> delete(DeleteQuery query, Class<?> entityType);
349338

350-
/**
351-
* Delete the documents matching the given {@link Query} extracting index from entity metadata.
352-
*
353-
* @param query must not be {@literal null}.
354-
* @param entityType must not be {@literal null}.
355-
* @param index the target index, must not be {@literal null}
356-
* @return a {@link Mono} emitting the number of the removed documents.
357-
* @deprecated since 5.3.0, use {@link #delete(DeleteQuery, Class, IndexCoordinates)}
358-
*/
359-
@Deprecated
360-
Mono<ByQueryResponse> delete(Query query, Class<?> entityType, IndexCoordinates index);
361-
362339
/**
363340
* Delete the documents matching the given {@link Query} extracting index from entity metadata.
364341
*

src/main/java/org/springframework/data/elasticsearch/repository/support/SimpleElasticsearchRepository.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ private void doDelete(@Nullable ID id, @Nullable String routing, IndexCoordinate
384384
public void deleteAll() {
385385

386386
executeAndRefresh((OperationsCallback<Void>) operations -> {
387-
operations.delete(Query.findAll(), entityClass, getIndexCoordinates());
387+
operations.delete(DeleteQuery.builder(Query.findAll()).build(), entityClass, getIndexCoordinates());
388388
return null;
389389
});
390390
}

0 commit comments

Comments
 (0)