Skip to content

Commit f206f11

Browse files
committed
Deprecate delete-by-query client/action/transport APIs
Closes elastic#10239
1 parent fe1a362 commit f206f11

14 files changed

+61
-7
lines changed

src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryAction.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
import org.elasticsearch.client.Client;
2424

2525
/**
26+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
27+
* request to delete them.
2628
*/
29+
@Deprecated
2730
public class DeleteByQueryAction extends ClientAction<DeleteByQueryRequest, DeleteByQueryResponse, DeleteByQueryRequestBuilder> {
2831

2932
public static final DeleteByQueryAction INSTANCE = new DeleteByQueryAction();

src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@
5252
* @see DeleteByQueryResponse
5353
* @see org.elasticsearch.client.Requests#deleteByQueryRequest(String...)
5454
* @see org.elasticsearch.client.Client#deleteByQuery(DeleteByQueryRequest)
55+
*
56+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
57+
* request to delete them.
5558
*/
59+
@Deprecated
5660
public class DeleteByQueryRequest extends IndicesReplicationOperationRequest<DeleteByQueryRequest> {
5761

5862
private BytesReference source;

src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequestBuilder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@
3232
import java.util.Map;
3333

3434
/**
35-
*
35+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
36+
* request to delete them.
3637
*/
38+
@Deprecated
3739
public class DeleteByQueryRequestBuilder extends IndicesReplicationOperationRequestBuilder<DeleteByQueryRequest, DeleteByQueryResponse, DeleteByQueryRequestBuilder> {
3840

3941
private QuerySourceBuilder sourceBuilder;

src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryResponse.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
/**
3434
* The response of delete by query action. Holds the {@link IndexDeleteByQueryResponse}s from all the
3535
* different indices.
36+
*
37+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
38+
* request to delete them.
3639
*/
40+
@Deprecated
3741
public class DeleteByQueryResponse extends ActionResponse implements Iterable<IndexDeleteByQueryResponse> {
3842

3943
private Map<String, IndexDeleteByQueryResponse> indices = newHashMap();

src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryRequest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727

2828
/**
2929
* Delete by query request to execute on a specific index.
30+
*
31+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
32+
* request to delete them.
3033
*/
34+
@Deprecated
3135
class IndexDeleteByQueryRequest extends IndexReplicationOperationRequest<IndexDeleteByQueryRequest> {
3236

3337
private final BytesReference source;

src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryResponse.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@
3030

3131
/**
3232
* Delete by query response executed on a specific index.
33+
*
34+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
35+
* request to delete them.
3336
*/
37+
@Deprecated
3438
public class IndexDeleteByQueryResponse extends ActionResponse {
3539

3640
private String index;
@@ -109,4 +113,4 @@ public void writeTo(StreamOutput out) throws IOException {
109113
failure.writeTo(out);
110114
}
111115
}
112-
}
116+
}

src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryRequest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@
4040

4141
/**
4242
* Delete by query request to execute on a specific shard.
43+
*
44+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
45+
* request to delete them.
4346
*/
47+
@Deprecated
4448
public class ShardDeleteByQueryRequest extends ShardReplicationOperationRequest<ShardDeleteByQueryRequest> {
4549

4650
private int shardId;

src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryResponse.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727

2828
/**
2929
* Delete by query response executed on a specific shard.
30+
*
31+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
32+
* request to delete them.
3033
*/
34+
@Deprecated
3135
public class ShardDeleteByQueryResponse extends ActionResponse {
3236

3337
@Override
@@ -39,4 +43,4 @@ public void readFrom(StreamInput in) throws IOException {
3943
public void writeTo(StreamOutput out) throws IOException {
4044
super.writeTo(out);
4145
}
42-
}
46+
}

src/main/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryAction.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@
3939
import java.util.concurrent.atomic.AtomicReferenceArray;
4040

4141
/**
42+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
43+
* request to delete them.
4244
*/
45+
@Deprecated
4346
public class TransportDeleteByQueryAction extends TransportIndicesReplicationOperationAction<DeleteByQueryRequest, DeleteByQueryResponse, IndexDeleteByQueryRequest, IndexDeleteByQueryResponse, ShardDeleteByQueryRequest, ShardDeleteByQueryRequest, ShardDeleteByQueryResponse> {
4447

4548
private final DestructiveOperations destructiveOperations;

src/main/java/org/elasticsearch/action/deletebyquery/TransportIndexDeleteByQueryAction.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@
3535

3636
/**
3737
* Internal transport action that broadcasts a delete by query request to all of the shards that belong to an index.
38+
*
39+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
40+
* request to delete them.
3841
*/
42+
@Deprecated
3943
public class TransportIndexDeleteByQueryAction extends TransportIndexReplicationOperationAction<IndexDeleteByQueryRequest, IndexDeleteByQueryResponse, ShardDeleteByQueryRequest, ShardDeleteByQueryRequest, ShardDeleteByQueryResponse> {
4044

4145
private static final String ACTION_NAME = DeleteByQueryAction.NAME + "[index]";

src/main/java/org/elasticsearch/action/deletebyquery/TransportShardDeleteByQueryAction.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@
4545
import org.elasticsearch.transport.TransportService;
4646

4747
/**
48-
*
48+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
49+
* request to delete them.
4950
*/
51+
@Deprecated
5052
public class TransportShardDeleteByQueryAction extends TransportShardReplicationOperationAction<ShardDeleteByQueryRequest, ShardDeleteByQueryRequest, ShardDeleteByQueryResponse> {
5153

5254
public final static String DELETE_BY_QUERY_API = "delete_by_query";

src/main/java/org/elasticsearch/client/Client.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,11 @@ public interface Client extends ElasticsearchClient<Client>, Releasable {
226226
* @param request The delete by query request
227227
* @return The result future
228228
* @see Requests#deleteByQueryRequest(String...)
229+
*
230+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
231+
* request to delete them.
229232
*/
233+
@Deprecated
230234
ActionFuture<DeleteByQueryResponse> deleteByQuery(DeleteByQueryRequest request);
231235

232236
/**
@@ -235,12 +239,20 @@ public interface Client extends ElasticsearchClient<Client>, Releasable {
235239
* @param request The delete by query request
236240
* @param listener A listener to be notified with a result
237241
* @see Requests#deleteByQueryRequest(String...)
242+
*
243+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
244+
* request to delete them.
238245
*/
246+
@Deprecated
239247
void deleteByQuery(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener);
240248

241249
/**
242250
* Deletes all documents from one or more indices based on a query.
251+
*
252+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
253+
* request to delete them.
243254
*/
255+
@Deprecated
244256
DeleteByQueryRequestBuilder prepareDeleteByQuery(String... indices);
245257

246258
/**

src/main/java/org/elasticsearch/index/engine/DeleteByQueryFailedEngineException.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
import org.elasticsearch.index.shard.ShardId;
2323

2424
/**
25-
*
25+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
26+
* request to delete them.
2627
*/
28+
@Deprecated
2729
public class DeleteByQueryFailedEngineException extends EngineException {
2830

2931
public DeleteByQueryFailedEngineException(ShardId shardId, Engine.DeleteByQuery deleteByQuery, Throwable cause) {
3032
super(shardId, "Delete by query failed for [" + deleteByQuery.query() + "]", cause);
3133
}
32-
}
34+
}

src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@
4141
import static org.elasticsearch.rest.RestRequest.Method.DELETE;
4242

4343
/**
44-
*
44+
* @deprecated Delete by query will be removed in 2.0. Instead, use the scroll/scan API to find all matching IDs and then issue a bulk
45+
* request to delete them.
4546
*/
47+
@Deprecated
4648
public class RestDeleteByQueryAction extends BaseRestHandler {
4749

4850
@Inject

0 commit comments

Comments
 (0)