From 11556155364e09fc601a12ef53021fd99fd03562 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Thu, 11 May 2017 18:27:05 +0200 Subject: [PATCH] Move DeleteByQuery and Reindex requests into core (#24578) This allows other plugins to use a client to call the functionality that is in the core modules without duplicating the logic. Plugins can now safely send the request and response classes via the client even if the requests are executed locally. All relevant classes are loaded by the core classloader such that plugins can share them. This is re-adds this commit that was revered in 952feb58e41bd0220784c44136b840ea4a740e26 --- .../resources/checkstyle_suppressions.xml | 1 - .../reindex}/AbstractBulkByScrollRequest.java | 4 ++-- .../AbstractBulkByScrollRequestBuilder.java | 2 +- .../AbstractBulkIndexByScrollRequest.java | 1 - ...stractBulkIndexByScrollRequestBuilder.java | 2 -- .../reindex}/BulkByScrollResponse.java | 15 ++++++------ .../reindex}/BulkByScrollTask.java | 2 +- .../reindex}/ClientScrollableHitSource.java | 2 +- .../index/reindex/DeleteByQueryAction.java | 2 -- .../reindex}/DeleteByQueryRequest.java | 4 ++-- .../reindex/DeleteByQueryRequestBuilder.java | 3 --- .../reindex}/ParentBulkByScrollTask.java | 4 ++-- .../index/reindex/ReindexRequest.java | 3 +-- .../index/reindex/ReindexRequestBuilder.java | 2 -- .../index/reindex}/RemoteInfo.java | 2 +- .../reindex}/ScrollableHitSource.java | 4 ++-- .../reindex}/SuccessfullyProcessed.java | 2 +- .../index/reindex/UpdateByQueryAction.java | 1 - .../index/reindex/UpdateByQueryRequest.java | 2 +- .../reindex/UpdateByQueryRequestBuilder.java | 1 - .../reindex}/WorkingBulkByScrollTask.java | 24 +++++++++---------- .../reindex}/package-info.java | 5 ++-- .../AbstractBulkByScrollRequestTestCase.java | 2 +- .../reindex}/BulkByScrollResponseTests.java | 11 ++++----- .../reindex}/BulkByScrollTaskStatusTests.java | 5 ++-- .../reindex}/BulkByScrollTaskTests.java | 2 +- .../reindex}/DeleteByQueryRequestTests.java | 2 +- .../reindex}/ParentBulkByScrollTaskTests.java | 2 +- .../index/reindex/ReindexRequestTests.java | 2 -- .../reindex/UpdateByQueryRequestTests.java | 1 - .../WorkingBulkByScrollTaskTests.java | 4 +--- .../AbstractAsyncBulkByScrollAction.java | 12 +++++----- .../AbstractBaseReindexRestHandler.java | 3 --- .../AbstractBulkByQueryRestHandler.java | 4 +--- .../reindex}/AsyncDeleteByQueryAction.java | 6 ++--- .../BulkByScrollParallelizationHelper.java | 12 +++++----- ...kIndexByScrollResponseContentListener.java | 3 +-- .../index/reindex/ReindexAction.java | 1 - .../index/reindex/ReindexPlugin.java | 1 - .../reindex/RestDeleteByQueryAction.java | 1 - .../index/reindex/RestReindexAction.java | 1 - .../reindex/TransportDeleteByQueryAction.java | 6 ----- .../index/reindex/TransportReindexAction.java | 9 +------ .../reindex/TransportRethrottleAction.java | 1 - .../reindex/TransportUpdateByQueryAction.java | 6 ----- .../reindex/remote/RemoteResponseParsers.java | 8 +++---- .../remote/RemoteScrollableHitSource.java | 2 +- ...yncBulkByScrollActionMetadataTestCase.java | 2 +- ...AsyncBulkByScrollActionScriptTestCase.java | 8 ++----- .../AsyncBulkByScrollActionTests.java | 8 +++---- ...ulkByScrollParallelizationHelperTests.java | 4 ++-- .../BulkIndexByScrollResponseMatcher.java | 5 ++-- .../BulkIndexByScrollResponseTests.java | 4 +--- .../index/reindex/CancelTests.java | 3 --- .../reindex/DeleteByQueryConcurrentTests.java | 1 - .../index/reindex/ReindexBasicTests.java | 1 - .../index/reindex/ReindexFailureTests.java | 1 - ...ReindexFromRemoteBuildRestClientTests.java | 1 - .../ReindexFromRemoteWhitelistTests.java | 1 - .../ReindexFromRemoteWithAuthTests.java | 1 - .../index/reindex/ReindexMetadataTests.java | 5 +--- .../reindex/ReindexParentChildTests.java | 1 - .../index/reindex/ReindexScriptTests.java | 1 - .../ReindexSourceTargetValidationTests.java | 1 - .../index/reindex/ReindexTestCase.java | 1 - .../index/reindex/ReindexVersioningTests.java | 1 - .../index/reindex/RestReindexActionTests.java | 1 - .../index/reindex/RethrottleTests.java | 3 --- .../index/reindex/RetryTests.java | 5 ---- .../index/reindex/RoundTripTests.java | 3 --- .../TransportRethrottleActionTests.java | 3 --- .../reindex/UpdateByQueryMetadataTests.java | 5 +--- .../UpdateByQueryWhileModifyingTests.java | 1 - .../reindex/UpdateByQueryWithScriptTests.java | 1 - .../index/reindex/remote/RemoteInfoTests.java | 1 + .../RemoteScrollableHitSourceTests.java | 2 +- ...stractAsyncBulkByScrollActionTestCase.java | 2 +- 77 files changed, 90 insertions(+), 182 deletions(-) rename core/src/main/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/AbstractBulkByScrollRequest.java (99%) rename core/src/main/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/AbstractBulkByScrollRequestBuilder.java (99%) rename {modules/reindex => core}/src/main/java/org/elasticsearch/index/reindex/AbstractBulkIndexByScrollRequest.java (97%) rename {modules/reindex => core}/src/main/java/org/elasticsearch/index/reindex/AbstractBulkIndexByScrollRequestBuilder.java (92%) rename core/src/main/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/BulkByScrollResponse.java (93%) rename core/src/main/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/BulkByScrollTask.java (99%) rename core/src/main/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/ClientScrollableHitSource.java (99%) rename {modules/reindex => core}/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryAction.java (91%) rename core/src/main/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/DeleteByQueryRequest.java (97%) rename {modules/reindex => core}/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryRequestBuilder.java (90%) rename core/src/main/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/ParentBulkByScrollTask.java (97%) rename {modules/reindex => core}/src/main/java/org/elasticsearch/index/reindex/ReindexRequest.java (97%) rename {modules/reindex => core}/src/main/java/org/elasticsearch/index/reindex/ReindexRequestBuilder.java (95%) rename {modules/reindex/src/main/java/org/elasticsearch/index/reindex/remote => core/src/main/java/org/elasticsearch/index/reindex}/RemoteInfo.java (99%) rename core/src/main/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/ScrollableHitSource.java (99%) rename core/src/main/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/SuccessfullyProcessed.java (96%) rename {modules/reindex => core}/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryAction.java (95%) rename {modules/reindex => core}/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryRequest.java (97%) rename {modules/reindex => core}/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryRequestBuilder.java (96%) rename core/src/main/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/WorkingBulkByScrollTask.java (95%) rename core/src/main/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/package-info.java (87%) rename {test/framework/src/main/java/org/elasticsearch/action/bulk/byscroll => core/src/test/java/org/elasticsearch/index/reindex}/AbstractBulkByScrollRequestTestCase.java (98%) rename core/src/test/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/BulkByScrollResponseTests.java (90%) rename core/src/test/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/BulkByScrollTaskStatusTests.java (97%) rename core/src/test/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/BulkByScrollTaskTests.java (99%) rename core/src/test/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/DeleteByQueryRequestTests.java (99%) rename core/src/test/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/ParentBulkByScrollTaskTests.java (99%) rename {modules/reindex => core}/src/test/java/org/elasticsearch/index/reindex/ReindexRequestTests.java (97%) rename {modules/reindex => core}/src/test/java/org/elasticsearch/index/reindex/UpdateByQueryRequestTests.java (97%) rename core/src/test/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/WorkingBulkByScrollTaskTests.java (98%) rename {core/src/main/java/org/elasticsearch/action/bulk/byscroll => modules/reindex/src/main/java/org/elasticsearch/index/reindex}/AbstractAsyncBulkByScrollAction.java (98%) rename {core/src/main/java/org/elasticsearch/action/bulk/byscroll => modules/reindex/src/main/java/org/elasticsearch/index/reindex}/AsyncDeleteByQueryAction.java (91%) rename {core/src/main/java/org/elasticsearch/action/bulk/byscroll => modules/reindex/src/main/java/org/elasticsearch/index/reindex}/BulkByScrollParallelizationHelper.java (88%) rename {test/framework/src/main/java/org/elasticsearch/action/bulk/byscroll => modules/reindex/src/test/java/org/elasticsearch/index/reindex}/AbstractAsyncBulkByScrollActionMetadataTestCase.java (96%) rename {core/src/test/java/org/elasticsearch/action/bulk/byscroll => modules/reindex/src/test/java/org/elasticsearch/index/reindex}/AsyncBulkByScrollActionTests.java (99%) rename {core/src/test/java/org/elasticsearch/action/bulk/byscroll => modules/reindex/src/test/java/org/elasticsearch/index/reindex}/BulkByScrollParallelizationHelperTests.java (94%) rename {test/framework/src/main/java/org/elasticsearch/action/bulk/byscroll => modules/reindex/src/test/java/org/elasticsearch/index/reindex}/BulkIndexByScrollResponseMatcher.java (98%) rename test/framework/src/main/java/org/elasticsearch/{action/bulk/byscroll => index/reindex}/AbstractAsyncBulkByScrollActionTestCase.java (97%) diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index 3e002803213..9a550740fde 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -127,7 +127,6 @@ - diff --git a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/AbstractBulkByScrollRequest.java b/core/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java similarity index 99% rename from core/src/main/java/org/elasticsearch/action/bulk/byscroll/AbstractBulkByScrollRequest.java rename to core/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java index 44580875011..a582248af11 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/AbstractBulkByScrollRequest.java +++ b/core/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.elasticsearch.Version; import org.elasticsearch.action.ActionRequest; @@ -355,7 +355,7 @@ public abstract class AbstractBulkByScrollRequest bulkFailures; - private List searchFailures; + private List searchFailures; private boolean timedOut; public BulkByScrollResponse() { } public BulkByScrollResponse(TimeValue took, BulkByScrollTask.Status status, List bulkFailures, - List searchFailures, boolean timedOut) { + List searchFailures, boolean timedOut) { this.took = took; this.status = requireNonNull(status, "Null status not supported"); this.bulkFailures = bulkFailures; @@ -139,7 +138,7 @@ public class BulkByScrollResponse extends ActionResponse implements ToXContent { /** * All search failures. */ - public List getSearchFailures() { + public List getSearchFailures() { return searchFailures; } @@ -166,7 +165,7 @@ public class BulkByScrollResponse extends ActionResponse implements ToXContent { took = new TimeValue(in); status = new BulkByScrollTask.Status(in); bulkFailures = in.readList(Failure::new); - searchFailures = in.readList(SearchFailure::new); + searchFailures = in.readList(ScrollableHitSource.SearchFailure::new); timedOut = in.readBoolean(); } @@ -181,7 +180,7 @@ public class BulkByScrollResponse extends ActionResponse implements ToXContent { failure.toXContent(builder, params); builder.endObject(); } - for (SearchFailure failure: searchFailures) { + for (ScrollableHitSource.SearchFailure failure: searchFailures) { failure.toXContent(builder, params); } builder.endArray(); @@ -199,4 +198,4 @@ public class BulkByScrollResponse extends ActionResponse implements ToXContent { builder.append(",search_failures=").append(getSearchFailures().subList(0, min(3, getSearchFailures().size()))); return builder.append(']').toString(); } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollTask.java b/core/src/main/java/org/elasticsearch/index/reindex/BulkByScrollTask.java similarity index 99% rename from core/src/main/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollTask.java rename to core/src/main/java/org/elasticsearch/index/reindex/BulkByScrollTask.java index 7c9124057b3..18c6dac9206 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollTask.java +++ b/core/src/main/java/org/elasticsearch/index/reindex/BulkByScrollTask.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.Version; diff --git a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/ClientScrollableHitSource.java b/core/src/main/java/org/elasticsearch/index/reindex/ClientScrollableHitSource.java similarity index 99% rename from core/src/main/java/org/elasticsearch/action/bulk/byscroll/ClientScrollableHitSource.java rename to core/src/main/java/org/elasticsearch/index/reindex/ClientScrollableHitSource.java index 3bacc187ebb..2f6775a1eae 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/ClientScrollableHitSource.java +++ b/core/src/main/java/org/elasticsearch/index/reindex/ClientScrollableHitSource.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryAction.java b/core/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryAction.java similarity index 91% rename from modules/reindex/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryAction.java rename to core/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryAction.java index b55fe33340e..c1abb16ca39 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryAction.java +++ b/core/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryAction.java @@ -20,8 +20,6 @@ package org.elasticsearch.index.reindex; import org.elasticsearch.action.Action; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse; -import org.elasticsearch.action.bulk.byscroll.DeleteByQueryRequest; import org.elasticsearch.client.ElasticsearchClient; public class DeleteByQueryAction extends Action { diff --git a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/DeleteByQueryRequest.java b/core/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryRequest.java similarity index 97% rename from core/src/main/java/org/elasticsearch/action/bulk/byscroll/DeleteByQueryRequest.java rename to core/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryRequest.java index 2644d0d9496..ad70748f3e4 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/DeleteByQueryRequest.java +++ b/core/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryRequest.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.IndicesRequest; @@ -81,7 +81,7 @@ public class DeleteByQueryRequest extends AbstractBulkByScrollRequest listener, int sliceId, Exception e) { + public void onSliceFailure(ActionListener listener, int sliceId, Exception e) { results.setOnce(sliceId, new Result(sliceId, e)); recordSliceCompletionAndRespondIfAllDone(listener); // TODO cancel when a slice fails? diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexRequest.java b/core/src/main/java/org/elasticsearch/index/reindex/ReindexRequest.java similarity index 97% rename from modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexRequest.java rename to core/src/main/java/org/elasticsearch/index/reindex/ReindexRequest.java index 2fa513f9c57..76944c7b804 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexRequest.java +++ b/core/src/main/java/org/elasticsearch/index/reindex/ReindexRequest.java @@ -26,7 +26,6 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.lucene.uid.Versions; -import org.elasticsearch.index.reindex.remote.RemoteInfo; import org.elasticsearch.tasks.TaskId; import java.io.IOException; @@ -128,7 +127,7 @@ public class ReindexRequest extends AbstractBulkIndexByScrollRequest { diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/remote/RemoteInfo.java b/core/src/main/java/org/elasticsearch/index/reindex/RemoteInfo.java similarity index 99% rename from modules/reindex/src/main/java/org/elasticsearch/index/reindex/remote/RemoteInfo.java rename to core/src/main/java/org/elasticsearch/index/reindex/RemoteInfo.java index 5fad275cde4..878a9c61e4c 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/remote/RemoteInfo.java +++ b/core/src/main/java/org/elasticsearch/index/reindex/RemoteInfo.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.index.reindex.remote; +package org.elasticsearch.index.reindex; import org.elasticsearch.Version; import org.elasticsearch.common.Nullable; diff --git a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/ScrollableHitSource.java b/core/src/main/java/org/elasticsearch/index/reindex/ScrollableHitSource.java similarity index 99% rename from core/src/main/java/org/elasticsearch/action/bulk/byscroll/ScrollableHitSource.java rename to core/src/main/java/org/elasticsearch/index/reindex/ScrollableHitSource.java index 6426bad592f..3d1eb582db8 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/ScrollableHitSource.java +++ b/core/src/main/java/org/elasticsearch/index/reindex/ScrollableHitSource.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.apache.logging.log4j.Logger; import org.elasticsearch.ElasticsearchException; @@ -111,7 +111,7 @@ public abstract class ScrollableHitSource { /** * Set the id of the last scroll. Used for debugging. */ - final void setScroll(String scrollId) { + public final void setScroll(String scrollId) { this.scrollId.set(scrollId); } diff --git a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/SuccessfullyProcessed.java b/core/src/main/java/org/elasticsearch/index/reindex/SuccessfullyProcessed.java similarity index 96% rename from core/src/main/java/org/elasticsearch/action/bulk/byscroll/SuccessfullyProcessed.java rename to core/src/main/java/org/elasticsearch/index/reindex/SuccessfullyProcessed.java index a0176e35202..6547984900e 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/SuccessfullyProcessed.java +++ b/core/src/main/java/org/elasticsearch/index/reindex/SuccessfullyProcessed.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; /** * Implemented by {@link BulkByScrollTask} and {@link BulkByScrollTask.Status} to consistently implement diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryAction.java b/core/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryAction.java similarity index 95% rename from modules/reindex/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryAction.java rename to core/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryAction.java index cb716e82248..1058f7f1307 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryAction.java +++ b/core/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryAction.java @@ -20,7 +20,6 @@ package org.elasticsearch.index.reindex; import org.elasticsearch.action.Action; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse; import org.elasticsearch.client.ElasticsearchClient; public class UpdateByQueryAction extends diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryRequest.java b/core/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryRequest.java similarity index 97% rename from modules/reindex/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryRequest.java rename to core/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryRequest.java index 3e7fac9d454..ad0123d76ce 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryRequest.java +++ b/core/src/main/java/org/elasticsearch/index/reindex/UpdateByQueryRequest.java @@ -71,7 +71,7 @@ public class UpdateByQueryRequest extends AbstractBulkIndexByScrollRequest randomSearchFailures() { + private List randomSearchFailures() { if (randomBoolean()) { return emptyList(); } @@ -68,7 +67,7 @@ public class BulkByScrollResponseTests extends ESTestCase { shardId = randomInt(); nodeId = usually() ? randomAlphaOfLength(5) : null; } - return singletonList(new SearchFailure(new ElasticsearchException("foo"), index, shardId, nodeId)); + return singletonList(new ScrollableHitSource.SearchFailure(new ElasticsearchException("foo"), index, shardId, nodeId)); } private void assertResponseEquals(BulkByScrollResponse expected, BulkByScrollResponse actual) { @@ -86,8 +85,8 @@ public class BulkByScrollResponseTests extends ESTestCase { } assertEquals(expected.getSearchFailures().size(), actual.getSearchFailures().size()); for (int i = 0; i < expected.getSearchFailures().size(); i++) { - SearchFailure expectedFailure = expected.getSearchFailures().get(i); - SearchFailure actualFailure = actual.getSearchFailures().get(i); + ScrollableHitSource.SearchFailure expectedFailure = expected.getSearchFailures().get(i); + ScrollableHitSource.SearchFailure actualFailure = actual.getSearchFailures().get(i); assertEquals(expectedFailure.getIndex(), actualFailure.getIndex()); assertEquals(expectedFailure.getShardId(), actualFailure.getShardId()); assertEquals(expectedFailure.getNodeId(), actualFailure.getNodeId()); diff --git a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollTaskStatusTests.java b/core/src/test/java/org/elasticsearch/index/reindex/BulkByScrollTaskStatusTests.java similarity index 97% rename from core/src/test/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollTaskStatusTests.java rename to core/src/test/java/org/elasticsearch/index/reindex/BulkByScrollTaskStatusTests.java index 503fe1db7cd..982198c8fee 100644 --- a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollTaskStatusTests.java +++ b/core/src/test/java/org/elasticsearch/index/reindex/BulkByScrollTaskStatusTests.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.ElasticsearchException; @@ -26,6 +26,7 @@ import org.elasticsearch.common.Randomness; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.test.ESTestCase; +import org.hamcrest.Matchers; import java.io.IOException; import java.util.List; @@ -75,7 +76,7 @@ public class BulkByScrollTaskStatusTests extends ESTestCase { assertEquals(expected.getReasonCancelled(), actual.getReasonCancelled()); assertEquals(expected.getThrottledUntil(), actual.getThrottledUntil()); if (version.onOrAfter(Version.V_5_1_1_UNRELEASED)) { - assertThat(actual.getSliceStatuses(), hasSize(expected.getSliceStatuses().size())); + assertThat(actual.getSliceStatuses(), Matchers.hasSize(expected.getSliceStatuses().size())); for (int i = 0; i < expected.getSliceStatuses().size(); i++) { BulkByScrollTask.StatusOrException sliceStatus = expected.getSliceStatuses().get(i); if (sliceStatus == null) { diff --git a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollTaskTests.java b/core/src/test/java/org/elasticsearch/index/reindex/BulkByScrollTaskTests.java similarity index 99% rename from core/src/test/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollTaskTests.java rename to core/src/test/java/org/elasticsearch/index/reindex/BulkByScrollTaskTests.java index ff0eae55520..f4d4ea790bc 100644 --- a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollTaskTests.java +++ b/core/src/test/java/org/elasticsearch/index/reindex/BulkByScrollTaskTests.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; diff --git a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/DeleteByQueryRequestTests.java b/core/src/test/java/org/elasticsearch/index/reindex/DeleteByQueryRequestTests.java similarity index 99% rename from core/src/test/java/org/elasticsearch/action/bulk/byscroll/DeleteByQueryRequestTests.java rename to core/src/test/java/org/elasticsearch/index/reindex/DeleteByQueryRequestTests.java index f5c00f63de9..8c84c8f3f56 100644 --- a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/DeleteByQueryRequestTests.java +++ b/core/src/test/java/org/elasticsearch/index/reindex/DeleteByQueryRequestTests.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.search.SearchRequest; diff --git a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/ParentBulkByScrollTaskTests.java b/core/src/test/java/org/elasticsearch/index/reindex/ParentBulkByScrollTaskTests.java similarity index 99% rename from core/src/test/java/org/elasticsearch/action/bulk/byscroll/ParentBulkByScrollTaskTests.java rename to core/src/test/java/org/elasticsearch/index/reindex/ParentBulkByScrollTaskTests.java index 715fcaaad54..6e2d44abed5 100644 --- a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/ParentBulkByScrollTaskTests.java +++ b/core/src/test/java/org/elasticsearch/index/reindex/ParentBulkByScrollTaskTests.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.elasticsearch.action.ActionListener; import org.elasticsearch.test.ESTestCase; diff --git a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/ReindexRequestTests.java b/core/src/test/java/org/elasticsearch/index/reindex/ReindexRequestTests.java similarity index 97% rename from modules/reindex/src/test/java/org/elasticsearch/index/reindex/ReindexRequestTests.java rename to core/src/test/java/org/elasticsearch/index/reindex/ReindexRequestTests.java index d1bb6f6096c..32b01237375 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/ReindexRequestTests.java +++ b/core/src/test/java/org/elasticsearch/index/reindex/ReindexRequestTests.java @@ -20,11 +20,9 @@ package org.elasticsearch.index.reindex; import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.bulk.byscroll.AbstractBulkByScrollRequestTestCase; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.common.bytes.BytesArray; -import org.elasticsearch.index.reindex.remote.RemoteInfo; import org.elasticsearch.search.slice.SliceBuilder; import static java.util.Collections.emptyMap; diff --git a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/UpdateByQueryRequestTests.java b/core/src/test/java/org/elasticsearch/index/reindex/UpdateByQueryRequestTests.java similarity index 97% rename from modules/reindex/src/test/java/org/elasticsearch/index/reindex/UpdateByQueryRequestTests.java rename to core/src/test/java/org/elasticsearch/index/reindex/UpdateByQueryRequestTests.java index 700f45b42c5..b30968cf056 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/UpdateByQueryRequestTests.java +++ b/core/src/test/java/org/elasticsearch/index/reindex/UpdateByQueryRequestTests.java @@ -19,7 +19,6 @@ package org.elasticsearch.index.reindex; -import org.elasticsearch.action.bulk.byscroll.AbstractBulkByScrollRequestTestCase; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.support.IndicesOptions; diff --git a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/WorkingBulkByScrollTaskTests.java b/core/src/test/java/org/elasticsearch/index/reindex/WorkingBulkByScrollTaskTests.java similarity index 98% rename from core/src/test/java/org/elasticsearch/action/bulk/byscroll/WorkingBulkByScrollTaskTests.java rename to core/src/test/java/org/elasticsearch/index/reindex/WorkingBulkByScrollTaskTests.java index 7356d626c10..5d594d080b8 100644 --- a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/WorkingBulkByScrollTaskTests.java +++ b/core/src/test/java/org/elasticsearch/index/reindex/WorkingBulkByScrollTaskTests.java @@ -17,10 +17,8 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollTask; -import org.elasticsearch.action.bulk.byscroll.WorkingBulkByScrollTask; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.tasks.TaskId; diff --git a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/AbstractAsyncBulkByScrollAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/action/bulk/byscroll/AbstractAsyncBulkByScrollAction.java rename to modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollAction.java index 3ba07ea5538..2a23823c858 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/AbstractAsyncBulkByScrollAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.apache.logging.log4j.Logger; import org.elasticsearch.action.ActionListener; @@ -31,7 +31,7 @@ import org.elasticsearch.action.bulk.BulkItemResponse.Failure; import org.elasticsearch.action.bulk.BulkRequest; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.bulk.Retry; -import org.elasticsearch.action.bulk.byscroll.ScrollableHitSource.SearchFailure; +import org.elasticsearch.index.reindex.ScrollableHitSource.SearchFailure; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.client.ParentTaskAssigningClient; @@ -77,7 +77,7 @@ import static java.lang.Math.min; import static java.util.Collections.emptyList; import static java.util.Collections.unmodifiableList; import static org.elasticsearch.action.bulk.BackoffPolicy.exponentialBackoff; -import static org.elasticsearch.action.bulk.byscroll.AbstractBulkByScrollRequest.SIZE_ALL_MATCHES; +import static org.elasticsearch.index.reindex.AbstractBulkByScrollRequest.SIZE_ALL_MATCHES; import static org.elasticsearch.common.unit.TimeValue.timeValueNanos; import static org.elasticsearch.rest.RestStatus.CONFLICT; import static org.elasticsearch.search.sort.SortBuilders.fieldSort; @@ -116,8 +116,8 @@ public abstract class AbstractAsyncBulkByScrollAction, ScrollableHitSource.Hit, RequestWrapper> scriptApplier; public AbstractAsyncBulkByScrollAction(WorkingBulkByScrollTask task, Logger logger, ParentTaskAssigningClient client, - ThreadPool threadPool, Request mainRequest, ScriptService scriptService, ClusterState clusterState, - ActionListener listener) { + ThreadPool threadPool, Request mainRequest, ScriptService scriptService, + ClusterState clusterState, ActionListener listener) { this(task, logger, client, threadPool, mainRequest, scriptService, clusterState, listener, client.settings()); } @@ -741,7 +741,7 @@ public abstract class AbstractAsyncBulkByScrollAction wrap(DeleteRequest request) { + public static RequestWrapper wrap(DeleteRequest request) { return new DeleteRequestWrapper(request); } diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBaseReindexRestHandler.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBaseReindexRestHandler.java index d70b3c9c4ce..64b02c4be81 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBaseReindexRestHandler.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBaseReindexRestHandler.java @@ -21,9 +21,6 @@ package org.elasticsearch.index.reindex; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.GenericAction; -import org.elasticsearch.action.bulk.byscroll.AbstractBulkByScrollRequest; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollTask; import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.settings.Settings; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByQueryRestHandler.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByQueryRestHandler.java index 480ca80e2ee..32a252ccc4b 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByQueryRestHandler.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByQueryRestHandler.java @@ -21,8 +21,6 @@ package org.elasticsearch.index.reindex; import org.apache.lucene.util.IOUtils; import org.elasticsearch.action.GenericAction; -import org.elasticsearch.action.bulk.byscroll.AbstractBulkByScrollRequest; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -35,7 +33,7 @@ import java.io.IOException; import java.util.Map; import java.util.function.Consumer; -import static org.elasticsearch.action.bulk.byscroll.AbstractBulkByScrollRequest.SIZE_ALL_MATCHES; +import static org.elasticsearch.index.reindex.AbstractBulkByScrollRequest.SIZE_ALL_MATCHES; /** * Rest handler for reindex actions that accepts a search request like Update-By-Query or Delete-By-Query diff --git a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/AsyncDeleteByQueryAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AsyncDeleteByQueryAction.java similarity index 91% rename from core/src/main/java/org/elasticsearch/action/bulk/byscroll/AsyncDeleteByQueryAction.java rename to modules/reindex/src/main/java/org/elasticsearch/index/reindex/AsyncDeleteByQueryAction.java index cdcfb754fb6..2608f5715ba 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/AsyncDeleteByQueryAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AsyncDeleteByQueryAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.apache.logging.log4j.Logger; import org.elasticsearch.action.ActionListener; @@ -32,8 +32,8 @@ import org.elasticsearch.threadpool.ThreadPool; */ public class AsyncDeleteByQueryAction extends AbstractAsyncBulkByScrollAction { public AsyncDeleteByQueryAction(WorkingBulkByScrollTask task, Logger logger, ParentTaskAssigningClient client, - ThreadPool threadPool, DeleteByQueryRequest request, ScriptService scriptService, ClusterState clusterState, - ActionListener listener) { + ThreadPool threadPool, DeleteByQueryRequest request, ScriptService scriptService, + ClusterState clusterState, ActionListener listener) { super(task, logger, client, threadPool, request, scriptService, clusterState, listener); } diff --git a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollParallelizationHelper.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/BulkByScrollParallelizationHelper.java similarity index 88% rename from core/src/main/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollParallelizationHelper.java rename to modules/reindex/src/main/java/org/elasticsearch/index/reindex/BulkByScrollParallelizationHelper.java index f2bd62c2335..48f10306454 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollParallelizationHelper.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/BulkByScrollParallelizationHelper.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.elasticsearch.action.Action; import org.elasticsearch.action.ActionListener; @@ -32,13 +32,13 @@ import org.elasticsearch.tasks.TaskManager; /** * Helps parallelize reindex requests using sliced scrolls. */ -public class BulkByScrollParallelizationHelper { +class BulkByScrollParallelizationHelper { private BulkByScrollParallelizationHelper() {} - public static < - Request extends AbstractBulkByScrollRequest - > void startSlices(Client client, TaskManager taskManager, Action action, - String localNodeId, ParentBulkByScrollTask task, Request request, ActionListener listener) { + public static > void startSlices(Client client, TaskManager taskManager, + Action action, + String localNodeId, ParentBulkByScrollTask task, Request request, + ActionListener listener) { TaskId parentTaskId = new TaskId(localNodeId, task.getId()); for (final SearchRequest slice : sliceIntoSubRequests(request.getSearchRequest(), UidFieldMapper.NAME, request.getSlices())) { // TODO move the request to the correct node. maybe here or somehow do it as part of startup for reindex in general.... diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/BulkIndexByScrollResponseContentListener.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/BulkIndexByScrollResponseContentListener.java index a8d321a9fab..8e5dff170d4 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/BulkIndexByScrollResponseContentListener.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/BulkIndexByScrollResponseContentListener.java @@ -21,8 +21,7 @@ package org.elasticsearch.index.reindex; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.bulk.BulkItemResponse.Failure; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse; -import org.elasticsearch.action.bulk.byscroll.ScrollableHitSource.SearchFailure; +import org.elasticsearch.index.reindex.ScrollableHitSource.SearchFailure; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BytesRestResponse; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexAction.java index 2c84cfc86be..1c53a925f0d 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexAction.java @@ -20,7 +20,6 @@ package org.elasticsearch.index.reindex; import org.elasticsearch.action.Action; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse; import org.elasticsearch.client.ElasticsearchClient; public class ReindexAction extends Action { diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexPlugin.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexPlugin.java index fb203ee5c6d..d601f5c06e7 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexPlugin.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/ReindexPlugin.java @@ -21,7 +21,6 @@ package org.elasticsearch.index.reindex; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollTask; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java index 0e11d64a405..f906ef7660d 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestDeleteByQueryAction.java @@ -20,7 +20,6 @@ package org.elasticsearch.index.reindex; import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.action.bulk.byscroll.DeleteByQueryRequest; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.settings.Settings; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java index 57d3213da92..6c16c31efb1 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestReindexAction.java @@ -36,7 +36,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.index.VersionType; import org.elasticsearch.index.query.QueryParseContext; -import org.elasticsearch.index.reindex.remote.RemoteInfo; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.script.Script; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportDeleteByQueryAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportDeleteByQueryAction.java index a17b2b81f91..99e1a9f166d 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportDeleteByQueryAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportDeleteByQueryAction.java @@ -20,12 +20,6 @@ package org.elasticsearch.index.reindex; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.bulk.byscroll.AsyncDeleteByQueryAction; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollParallelizationHelper; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse; -import org.elasticsearch.action.bulk.byscroll.DeleteByQueryRequest; -import org.elasticsearch.action.bulk.byscroll.ParentBulkByScrollTask; -import org.elasticsearch.action.bulk.byscroll.WorkingBulkByScrollTask; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; import org.elasticsearch.client.Client; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportReindexAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportReindexAction.java index b232c50c2b2..737d885443a 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportReindexAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportReindexAction.java @@ -37,13 +37,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.bulk.BackoffPolicy; import org.elasticsearch.action.bulk.BulkItemResponse.Failure; -import org.elasticsearch.action.bulk.byscroll.AbstractAsyncBulkByScrollAction; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollParallelizationHelper; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse; -import org.elasticsearch.action.bulk.byscroll.ParentBulkByScrollTask; -import org.elasticsearch.action.bulk.byscroll.ScrollableHitSource; -import org.elasticsearch.action.bulk.byscroll.ScrollableHitSource.SearchFailure; -import org.elasticsearch.action.bulk.byscroll.WorkingBulkByScrollTask; +import org.elasticsearch.index.reindex.ScrollableHitSource.SearchFailure; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.support.ActionFilters; @@ -68,7 +62,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.VersionType; import org.elasticsearch.index.mapper.VersionFieldMapper; -import org.elasticsearch.index.reindex.remote.RemoteInfo; import org.elasticsearch.index.reindex.remote.RemoteScrollableHitSource; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptService; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportRethrottleAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportRethrottleAction.java index 88329f5cb17..0901e5ade31 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportRethrottleAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportRethrottleAction.java @@ -24,7 +24,6 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.FailedNodeException; import org.elasticsearch.action.TaskOperationFailure; import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollTask; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.tasks.TransportTasksAction; import org.elasticsearch.client.Client; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportUpdateByQueryAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportUpdateByQueryAction.java index 12d8696319f..8924c7038c9 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportUpdateByQueryAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/TransportUpdateByQueryAction.java @@ -21,12 +21,6 @@ package org.elasticsearch.index.reindex; import org.apache.logging.log4j.Logger; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.bulk.byscroll.AbstractAsyncBulkByScrollAction; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse; -import org.elasticsearch.action.bulk.byscroll.ParentBulkByScrollTask; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollParallelizationHelper; -import org.elasticsearch.action.bulk.byscroll.ScrollableHitSource; -import org.elasticsearch.action.bulk.byscroll.WorkingBulkByScrollTask; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/remote/RemoteResponseParsers.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/remote/RemoteResponseParsers.java index e9807bdfa5b..d9a897026d2 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/remote/RemoteResponseParsers.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/remote/RemoteResponseParsers.java @@ -20,10 +20,10 @@ package org.elasticsearch.index.reindex.remote; import org.elasticsearch.Version; -import org.elasticsearch.action.bulk.byscroll.ScrollableHitSource.BasicHit; -import org.elasticsearch.action.bulk.byscroll.ScrollableHitSource.Hit; -import org.elasticsearch.action.bulk.byscroll.ScrollableHitSource.Response; -import org.elasticsearch.action.bulk.byscroll.ScrollableHitSource.SearchFailure; +import org.elasticsearch.index.reindex.ScrollableHitSource.BasicHit; +import org.elasticsearch.index.reindex.ScrollableHitSource.Hit; +import org.elasticsearch.index.reindex.ScrollableHitSource.Response; +import org.elasticsearch.index.reindex.ScrollableHitSource.SearchFailure; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.collect.Tuple; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/remote/RemoteScrollableHitSource.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/remote/RemoteScrollableHitSource.java index f3caeb004c4..85173b7d899 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/remote/RemoteScrollableHitSource.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/remote/RemoteScrollableHitSource.java @@ -30,7 +30,7 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.Version; import org.elasticsearch.action.bulk.BackoffPolicy; -import org.elasticsearch.action.bulk.byscroll.ScrollableHitSource; +import org.elasticsearch.index.reindex.ScrollableHitSource; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.client.ResponseException; import org.elasticsearch.client.ResponseListener; diff --git a/test/framework/src/main/java/org/elasticsearch/action/bulk/byscroll/AbstractAsyncBulkByScrollActionMetadataTestCase.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollActionMetadataTestCase.java similarity index 96% rename from test/framework/src/main/java/org/elasticsearch/action/bulk/byscroll/AbstractAsyncBulkByScrollActionMetadataTestCase.java rename to modules/reindex/src/test/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollActionMetadataTestCase.java index b68797381d1..34da9f56b48 100644 --- a/test/framework/src/main/java/org/elasticsearch/action/bulk/byscroll/AbstractAsyncBulkByScrollActionMetadataTestCase.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollActionMetadataTestCase.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; public abstract class AbstractAsyncBulkByScrollActionMetadataTestCase< Request extends AbstractBulkByScrollRequest, diff --git a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollActionScriptTestCase.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollActionScriptTestCase.java index fd41a6d25f3..6ddf6daa880 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollActionScriptTestCase.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollActionScriptTestCase.java @@ -20,12 +20,8 @@ package org.elasticsearch.index.reindex; import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.bulk.byscroll.AbstractAsyncBulkByScrollAction; -import org.elasticsearch.action.bulk.byscroll.AbstractAsyncBulkByScrollAction.OpType; -import org.elasticsearch.action.bulk.byscroll.AbstractAsyncBulkByScrollAction.RequestWrapper; -import org.elasticsearch.action.bulk.byscroll.AbstractAsyncBulkByScrollActionTestCase; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse; -import org.elasticsearch.action.bulk.byscroll.ScrollableHitSource; +import org.elasticsearch.index.reindex.AbstractAsyncBulkByScrollAction.OpType; +import org.elasticsearch.index.reindex.AbstractAsyncBulkByScrollAction.RequestWrapper; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.script.CompiledScript; diff --git a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/AsyncBulkByScrollActionTests.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/AsyncBulkByScrollActionTests.java similarity index 99% rename from core/src/test/java/org/elasticsearch/action/bulk/byscroll/AsyncBulkByScrollActionTests.java rename to modules/reindex/src/test/java/org/elasticsearch/index/reindex/AsyncBulkByScrollActionTests.java index fa42573e439..5c437da3464 100644 --- a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/AsyncBulkByScrollActionTests.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/AsyncBulkByScrollActionTests.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; @@ -36,8 +36,8 @@ import org.elasticsearch.action.bulk.BulkItemResponse; import org.elasticsearch.action.bulk.BulkItemResponse.Failure; import org.elasticsearch.action.bulk.BulkRequest; import org.elasticsearch.action.bulk.BulkResponse; -import org.elasticsearch.action.bulk.byscroll.ScrollableHitSource.Hit; -import org.elasticsearch.action.bulk.byscroll.ScrollableHitSource.SearchFailure; +import org.elasticsearch.index.reindex.ScrollableHitSource.Hit; +import org.elasticsearch.index.reindex.ScrollableHitSource.SearchFailure; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.delete.DeleteResponse; import org.elasticsearch.action.index.IndexRequest; @@ -696,7 +696,7 @@ public class AsyncBulkByScrollActionTests extends ESTestCase { } @Override - protected DummyAbstractBulkByScrollRequest forSlice(TaskId slicingTask, SearchRequest slice) { + public DummyAbstractBulkByScrollRequest forSlice(TaskId slicingTask, SearchRequest slice) { throw new UnsupportedOperationException(); } diff --git a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollParallelizationHelperTests.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/BulkByScrollParallelizationHelperTests.java similarity index 94% rename from core/src/test/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollParallelizationHelperTests.java rename to modules/reindex/src/test/java/org/elasticsearch/index/reindex/BulkByScrollParallelizationHelperTests.java index 498c6bf5286..a64415d08b1 100644 --- a/core/src/test/java/org/elasticsearch/action/bulk/byscroll/BulkByScrollParallelizationHelperTests.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/BulkByScrollParallelizationHelperTests.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.index.mapper.IdFieldMapper; @@ -27,7 +27,7 @@ import org.elasticsearch.test.ESTestCase; import java.io.IOException; import static java.util.Collections.emptyList; -import static org.elasticsearch.action.bulk.byscroll.BulkByScrollParallelizationHelper.sliceIntoSubRequests; +import static org.elasticsearch.index.reindex.BulkByScrollParallelizationHelper.sliceIntoSubRequests; import static org.elasticsearch.search.RandomSearchRequestGenerator.randomSearchRequest; import static org.elasticsearch.search.RandomSearchRequestGenerator.randomSearchSourceBuilder; diff --git a/test/framework/src/main/java/org/elasticsearch/action/bulk/byscroll/BulkIndexByScrollResponseMatcher.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/BulkIndexByScrollResponseMatcher.java similarity index 98% rename from test/framework/src/main/java/org/elasticsearch/action/bulk/byscroll/BulkIndexByScrollResponseMatcher.java rename to modules/reindex/src/test/java/org/elasticsearch/index/reindex/BulkIndexByScrollResponseMatcher.java index 2902e02a30c..cb2ff1a7ae2 100644 --- a/test/framework/src/main/java/org/elasticsearch/action/bulk/byscroll/BulkIndexByScrollResponseMatcher.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/BulkIndexByScrollResponseMatcher.java @@ -17,9 +17,8 @@ * under the License. */ -package org.elasticsearch.action.bulk.byscroll; +package org.elasticsearch.index.reindex; -import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; @@ -155,4 +154,4 @@ public class BulkIndexByScrollResponseMatcher extends TypeSafeMatcher