Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert delete-by-query deprecations #10443

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/java-api/delete-by-query.asciidoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[[delete-by-query]]
== Delete By Query API

deprecated[1.5.0, "Delete by Query will be removed in 2.0: it is problematic since it silently forces a refresh which can quickly cause OutOfMemoryError during concurrent indexing, and can also cause primary and replica to become inconsistent. Instead, use the <<search,scroll/scan API>> to find all matching ids and then issue a bulk request to delete them.]

The delete by query API allows one to delete documents from one or more
indices and one or more types based on a <<query-dsl-queries,query>>. Here
is an example:
Expand Down
2 changes: 0 additions & 2 deletions docs/reference/docs/delete-by-query.asciidoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[[docs-delete-by-query]]
== Delete By Query API

deprecated[1.5.0, "Delete by Query will be removed in 2.0: it is problematic since it silently forces a refresh which can quickly cause OutOfMemoryError during concurrent indexing, and can also cause primary and replica to become inconsistent. Instead, use the <<search-request-scroll,scroll/scan API>> to find all matching ids and then issue a bulk request to delete them.]

The delete by query API allows to delete documents from one or more
indices and one or more types based on a query. The query can either be
provided using a simple query string as a parameter, or using the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
import org.elasticsearch.client.Client;

/**
* @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
* request to delete them.
*/
@Deprecated
public class DeleteByQueryAction extends ClientAction<DeleteByQueryRequest, DeleteByQueryResponse, DeleteByQueryRequestBuilder> {

public static final DeleteByQueryAction INSTANCE = new DeleteByQueryAction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@
* @see DeleteByQueryResponse
* @see org.elasticsearch.client.Requests#deleteByQueryRequest(String...)
* @see org.elasticsearch.client.Client#deleteByQuery(DeleteByQueryRequest)
*
* @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
* request to delete them.
*/
@Deprecated
public class DeleteByQueryRequest extends IndicesReplicationOperationRequest<DeleteByQueryRequest> {

private BytesReference source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@
import java.util.Map;

/**
* @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
* request to delete them.
*
*/
@Deprecated
public class DeleteByQueryRequestBuilder extends IndicesReplicationOperationRequestBuilder<DeleteByQueryRequest, DeleteByQueryResponse, DeleteByQueryRequestBuilder> {

private QuerySourceBuilder sourceBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@
/**
* The response of delete by query action. Holds the {@link IndexDeleteByQueryResponse}s from all the
* different indices.
*
* @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
* request to delete them.
*/
@Deprecated
public class DeleteByQueryResponse extends ActionResponse implements Iterable<IndexDeleteByQueryResponse> {

private Map<String, IndexDeleteByQueryResponse> indices = newHashMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@

/**
* Delete by query request to execute on a specific index.
*
* @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
* request to delete them.
*/
@Deprecated
class IndexDeleteByQueryRequest extends IndexReplicationOperationRequest<IndexDeleteByQueryRequest> {

private final BytesReference source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@

/**
* Delete by query response executed on a specific index.
*
* @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
* request to delete them.
*/
@Deprecated
public class IndexDeleteByQueryResponse extends ActionResponse {

private String index;
Expand Down Expand Up @@ -113,4 +109,4 @@ public void writeTo(StreamOutput out) throws IOException {
failure.writeTo(out);
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unintentional removal of newline?

Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@

/**
* Delete by query request to execute on a specific shard.
*
* @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
* request to delete them.
*/
@Deprecated
public class ShardDeleteByQueryRequest extends ShardReplicationOperationRequest<ShardDeleteByQueryRequest> {

private int shardId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@

/**
* Delete by query response executed on a specific shard.
*
* @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
* request to delete them.
*/
@Deprecated
public class ShardDeleteByQueryResponse extends ActionResponse {

@Override
Expand All @@ -43,4 +39,4 @@ public void readFrom(StreamInput in) throws IOException {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto?

Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@
import java.util.concurrent.atomic.AtomicReferenceArray;

/**
* @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
* request to delete them.
*/
@Deprecated
public class TransportDeleteByQueryAction extends TransportIndicesReplicationOperationAction<DeleteByQueryRequest, DeleteByQueryResponse, IndexDeleteByQueryRequest, IndexDeleteByQueryResponse, ShardDeleteByQueryRequest, ShardDeleteByQueryRequest, ShardDeleteByQueryResponse> {

private final DestructiveOperations destructiveOperations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@

/**
* Internal transport action that broadcasts a delete by query request to all of the shards that belong to an index.
*
* @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
* request to delete them.
*/
@Deprecated
public class TransportIndexDeleteByQueryAction extends TransportIndexReplicationOperationAction<IndexDeleteByQueryRequest, IndexDeleteByQueryResponse, ShardDeleteByQueryRequest, ShardDeleteByQueryRequest, ShardDeleteByQueryResponse> {

private static final String ACTION_NAME = DeleteByQueryAction.NAME + "[index]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@
import org.elasticsearch.transport.TransportService;

/**
* @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
* request to delete them.
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just remove an empty javadoc block?

*/
@Deprecated
public class TransportShardDeleteByQueryAction extends TransportShardReplicationOperationAction<ShardDeleteByQueryRequest, ShardDeleteByQueryRequest, ShardDeleteByQueryResponse> {

public final static String DELETE_BY_QUERY_API = "delete_by_query";
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/org/elasticsearch/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,7 @@ public interface Client extends ElasticsearchClient<Client>, Releasable {
* @param request The delete by query request
* @return The result future
* @see Requests#deleteByQueryRequest(String...)
*
* @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
* request to delete them.
*/
@Deprecated
ActionFuture<DeleteByQueryResponse> deleteByQuery(DeleteByQueryRequest request);

/**
Expand All @@ -239,20 +235,12 @@ public interface Client extends ElasticsearchClient<Client>, Releasable {
* @param request The delete by query request
* @param listener A listener to be notified with a result
* @see Requests#deleteByQueryRequest(String...)
*
* @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
* request to delete them.
*/
@Deprecated
void deleteByQuery(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener);

/**
* Deletes all documents from one or more indices based on a query.
*
* @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
* request to delete them.
*/
@Deprecated
DeleteByQueryRequestBuilder prepareDeleteByQuery(String... indices);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@
import org.elasticsearch.index.shard.ShardId;

/**
* @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
* request to delete them.
*
*/
@Deprecated
public class DeleteByQueryFailedEngineException extends EngineException {

public DeleteByQueryFailedEngineException(ShardId shardId, Engine.DeleteByQuery deleteByQuery, Throwable cause) {
super(shardId, "Delete by query failed for [" + deleteByQuery.query() + "]", cause);
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another newline removal

Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@
import static org.elasticsearch.rest.RestRequest.Method.DELETE;

/**
* @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
* request to delete them.
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto on removing empty comment?

*/
@Deprecated
public class RestDeleteByQueryAction extends BaseRestHandler {

@Inject
Expand Down