- * For example indices that don't exist.
- */
- public DeleteByQueryRequestBuilder setIndicesOptions(IndicesOptions options) {
- request.indicesOptions(options);
- return this;
- }
-
- /**
- * The query used to delete documents.
- *
- * @see org.elasticsearch.index.query.QueryBuilders
- */
- public DeleteByQueryRequestBuilder setQuery(QueryBuilder queryBuilder) {
- request.query(queryBuilder);
- return this;
- }
-
- /**
- * A comma separated list of routing values to control the shards the action will be executed on.
- */
- public DeleteByQueryRequestBuilder setRouting(String routing) {
- request.routing(routing);
- return this;
- }
-
- /**
- * The routing values to control the shards that the action will be executed on.
- */
- public DeleteByQueryRequestBuilder setRouting(String... routing) {
- request.routing(routing);
- return this;
- }
-
- /**
- * An optional timeout to control how long the delete by query is allowed to take.
- */
- public DeleteByQueryRequestBuilder setTimeout(TimeValue timeout) {
- request.timeout(timeout);
- return this;
- }
-
- /**
- * An optional timeout to control how long the delete by query is allowed to take.
- */
- public DeleteByQueryRequestBuilder setTimeout(String timeout) {
- request.timeout(timeout);
- return this;
- }
-
- /**
- * The types of documents the query will run against. Defaults to all types.
- */
- public DeleteByQueryRequestBuilder setTypes(String... types) {
- request.types(types);
- return this;
- }
-
-}
diff --git a/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryResponse.java b/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryResponse.java
deleted file mode 100644
index 80fae396a25..00000000000
--- a/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryResponse.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.action.deletebyquery;
-
-import org.elasticsearch.action.ActionResponse;
-import org.elasticsearch.action.ShardOperationFailedException;
-import org.elasticsearch.action.search.ShardSearchFailure;
-import org.elasticsearch.common.io.stream.StreamInput;
-import org.elasticsearch.common.io.stream.StreamOutput;
-import org.elasticsearch.common.unit.TimeValue;
-import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.XContentBuilder;
-
-import java.io.IOException;
-
-import static org.elasticsearch.action.search.ShardSearchFailure.readShardSearchFailure;
-
-/**
- * Delete by query response
- * @see DeleteByQueryRequest
- */
-public class DeleteByQueryResponse extends ActionResponse implements ToXContent {
-
- private long tookInMillis;
- private boolean timedOut = false;
-
- private long found;
- private long deleted;
- private long missing;
- private long failed;
-
- private IndexDeleteByQueryResponse[] indices = IndexDeleteByQueryResponse.EMPTY_ARRAY;
- private ShardOperationFailedException[] shardFailures = ShardSearchFailure.EMPTY_ARRAY;
-
- DeleteByQueryResponse() {
- }
-
- DeleteByQueryResponse(long tookInMillis, boolean timedOut, long found, long deleted, long missing, long failed, IndexDeleteByQueryResponse[] indices, ShardOperationFailedException[] shardFailures) {
- this.tookInMillis = tookInMillis;
- this.timedOut = timedOut;
- this.found = found;
- this.deleted = deleted;
- this.missing = missing;
- this.failed = failed;
- this.indices = indices;
- this.shardFailures = shardFailures;
- }
-
- /**
- * The responses from all the different indices.
- */
- public IndexDeleteByQueryResponse[] getIndices() {
- return indices;
- }
-
- /**
- * The response of a specific index.
- */
- public IndexDeleteByQueryResponse getIndex(String index) {
- if (index == null) {
- return null;
- }
- for (IndexDeleteByQueryResponse i : indices) {
- if (index.equals(i.getIndex())) {
- return i;
- }
- }
- return null;
- }
-
- public TimeValue getTook() {
- return new TimeValue(tookInMillis);
- }
-
- public long getTookInMillis() {
- return tookInMillis;
- }
-
- public boolean isTimedOut() {
- return this.timedOut;
- }
-
- public long getTotalFound() {
- return found;
- }
-
- public long getTotalDeleted() {
- return deleted;
- }
-
- public long getTotalMissing() {
- return missing;
- }
-
- public long getTotalFailed() {
- return failed;
- }
-
- public ShardOperationFailedException[] getShardFailures() {
- return shardFailures;
- }
-
- @Override
- public void readFrom(StreamInput in) throws IOException {
- super.readFrom(in);
- tookInMillis = in.readVLong();
- timedOut = in.readBoolean();
- found = in.readVLong();
- deleted = in.readVLong();
- missing = in.readVLong();
- failed = in.readVLong();
-
- int size = in.readVInt();
- indices = new IndexDeleteByQueryResponse[size];
- for (int i = 0; i < size; i++) {
- IndexDeleteByQueryResponse index = new IndexDeleteByQueryResponse();
- index.readFrom(in);
- indices[i] = index;
- }
-
- size = in.readVInt();
- if (size == 0) {
- shardFailures = ShardSearchFailure.EMPTY_ARRAY;
- } else {
- shardFailures = new ShardSearchFailure[size];
- for (int i = 0; i < shardFailures.length; i++) {
- shardFailures[i] = readShardSearchFailure(in);
- }
- }
- }
-
- @Override
- public void writeTo(StreamOutput out) throws IOException {
- super.writeTo(out);
- out.writeVLong(tookInMillis);
- out.writeBoolean(timedOut);
- out.writeVLong(found);
- out.writeVLong(deleted);
- out.writeVLong(missing);
- out.writeVLong(failed);
-
- out.writeVInt(indices.length);
- for (IndexDeleteByQueryResponse indexResponse : indices) {
- indexResponse.writeTo(out);
- }
-
- out.writeVInt(shardFailures.length);
- for (ShardOperationFailedException shardSearchFailure : shardFailures) {
- shardSearchFailure.writeTo(out);
- }
- }
-
- static final class Fields {
- static final String TOOK = "took";
- static final String TIMED_OUT = "timed_out";
- static final String INDICES = "_indices";
- static final String FAILURES = "failures";
- }
-
- @Override
- public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
- builder.field(Fields.TOOK, tookInMillis);
- builder.field(Fields.TIMED_OUT, timedOut);
-
- builder.startObject(Fields.INDICES);
- IndexDeleteByQueryResponse all = new IndexDeleteByQueryResponse("_all", found, deleted, missing, failed);
- all.toXContent(builder, params);
- for (IndexDeleteByQueryResponse indexResponse : indices) {
- indexResponse.toXContent(builder, params);
- }
- builder.endObject();
-
- builder.startArray(Fields.FAILURES);
- if (shardFailures != null) {
- for (ShardOperationFailedException shardFailure : shardFailures) {
- builder.startObject();
- shardFailure.toXContent(builder, params);
- builder.endObject();
- }
- }
- builder.endArray();
- return builder;
- }
-}
diff --git a/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryResponse.java b/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryResponse.java
deleted file mode 100644
index 78fca1ef5f1..00000000000
--- a/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryResponse.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.action.deletebyquery;
-
-import org.elasticsearch.action.ActionResponse;
-import org.elasticsearch.common.io.stream.StreamInput;
-import org.elasticsearch.common.io.stream.StreamOutput;
-import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.XContentBuilder;
-
-import java.io.IOException;
-
-/**
- * Delete by query response executed on a specific index.
- */
-public class IndexDeleteByQueryResponse extends ActionResponse implements ToXContent {
-
- public static final IndexDeleteByQueryResponse[] EMPTY_ARRAY = new IndexDeleteByQueryResponse[0];
-
- private String index;
-
- private long found = 0L;
- private long deleted = 0L;
- private long missing = 0L;
- private long failed = 0L;
-
- IndexDeleteByQueryResponse() {
- }
-
- IndexDeleteByQueryResponse(String index) {
- this.index = index;
- }
-
- /**
- * Instantiates an IndexDeleteByQueryResponse with given values for counters. Counters should not be negative.
- */
- public IndexDeleteByQueryResponse(String index, long found, long deleted, long missing, long failed) {
- this(index);
- incrementFound(found);
- incrementDeleted(deleted);
- incrementMissing(missing);
- incrementFailed(failed);
- }
-
- public String getIndex() {
- return this.index;
- }
-
- public long getFound() {
- return found;
- }
-
- public void incrementFound() {
- incrementFound(1L);
- }
-
- public void incrementFound(long delta) {
- assert (found + delta >= 0) : "counter 'found' cannot be negative";
- this.found = found + delta;
- }
-
- public long getDeleted() {
- return deleted;
- }
-
- public void incrementDeleted() {
- incrementDeleted(1L);
- }
-
- public void incrementDeleted(long delta) {
- assert (deleted + delta >= 0) : "counter 'deleted' cannot be negative";
- this.deleted = deleted + delta;
- }
-
- public long getMissing() {
- return missing;
- }
-
- public void incrementMissing() {
- incrementMissing(1L);
- }
-
- public void incrementMissing(long delta) {
- assert (missing + delta >= 0) : "counter 'missing' cannot be negative";
- this.missing = missing + delta;
- }
-
- public long getFailed() {
- return failed;
- }
-
- public void incrementFailed() {
- incrementFailed(1L);
- }
-
- public void incrementFailed(long delta) {
- assert (failed + delta >= 0) : "counter 'failed' cannot be negative";
- this.failed = failed + delta;
- }
-
- @Override
- public void readFrom(StreamInput in) throws IOException {
- super.readFrom(in);
- index = in.readString();
- found = in.readVLong();
- deleted = in.readVLong();
- missing = in.readVLong();
- failed = in.readVLong();
- }
-
- @Override
- public void writeTo(StreamOutput out) throws IOException {
- super.writeTo(out);
- out.writeString(index);
- out.writeVLong(found);
- out.writeVLong(deleted);
- out.writeVLong(missing);
- out.writeVLong(failed);
- }
-
- static final class Fields {
- static final String FOUND = "found";
- static final String DELETED = "deleted";
- static final String MISSING = "missing";
- static final String FAILED = "failed";
- }
-
- @Override
- public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
- builder.startObject(index);
- builder.field(Fields.FOUND, found);
- builder.field(Fields.DELETED, deleted);
- builder.field(Fields.MISSING, missing);
- builder.field(Fields.FAILED, failed);
- builder.endObject();
- return builder;
- }
-}
diff --git a/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryAction.java b/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryAction.java
deleted file mode 100644
index f4127c4e532..00000000000
--- a/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryAction.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.action.deletebyquery;
-
-import org.elasticsearch.ExceptionsHelper;
-import org.elasticsearch.action.ActionListener;
-import org.elasticsearch.action.ShardOperationFailedException;
-import org.elasticsearch.action.bulk.BulkItemResponse;
-import org.elasticsearch.action.bulk.BulkRequest;
-import org.elasticsearch.action.bulk.BulkResponse;
-import org.elasticsearch.action.delete.DeleteRequest;
-import org.elasticsearch.action.delete.DeleteResponse;
-import org.elasticsearch.action.search.ClearScrollRequest;
-import org.elasticsearch.action.search.ClearScrollResponse;
-import org.elasticsearch.action.search.SearchRequest;
-import org.elasticsearch.action.search.SearchResponse;
-import org.elasticsearch.action.search.SearchScrollRequest;
-import org.elasticsearch.action.search.ShardSearchFailure;
-import org.elasticsearch.action.search.TransportSearchAction;
-import org.elasticsearch.action.search.TransportSearchScrollAction;
-import org.elasticsearch.action.support.ActionFilters;
-import org.elasticsearch.action.support.HandledTransportAction;
-import org.elasticsearch.client.Client;
-import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
-import org.elasticsearch.common.Strings;
-import org.elasticsearch.common.inject.Inject;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.util.CollectionUtils;
-import org.elasticsearch.search.SearchHit;
-import org.elasticsearch.search.SearchHitField;
-import org.elasticsearch.search.builder.SearchSourceBuilder;
-import org.elasticsearch.threadpool.ThreadPool;
-import org.elasticsearch.transport.TransportService;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * Delete-By-Query implementation that uses efficient scrolling and bulks deletions to delete large set of documents.
- */
-public class TransportDeleteByQueryAction extends HandledTransportAction