diff --git a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexByScrollAction.java b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexByScrollAction.java index 15be3370fb7..516ddb3658b 100644 --- a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexByScrollAction.java +++ b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexByScrollAction.java @@ -52,7 +52,9 @@ import static java.util.Collections.emptyMap; * Abstract base for scrolling across a search and executing bulk indexes on all * results. */ -public abstract class AbstractAsyncBulkIndexByScrollAction, Response extends BulkIndexByScrollResponse> +public abstract class AbstractAsyncBulkIndexByScrollAction< + Request extends AbstractBulkIndexByScrollRequest, + Response extends BulkIndexByScrollResponse> extends AbstractAsyncBulkByScrollAction { private final ScriptService scriptService; diff --git a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/AbstractBulkByScrollRequest.java b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/AbstractBulkByScrollRequest.java index f1e6198170e..9ac386fb153 100644 --- a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/AbstractBulkByScrollRequest.java +++ b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/AbstractBulkByScrollRequest.java @@ -254,7 +254,7 @@ public abstract class AbstractBulkByScrollRequest, Response extends ActionResponse, Self extends AbstractBulkByScrollRequestBuilder> +public abstract class AbstractBulkByScrollRequestBuilder< + Request extends AbstractBulkByScrollRequest, + Response extends ActionResponse, + Self extends AbstractBulkByScrollRequestBuilder> extends ActionRequestBuilder { private final SearchRequestBuilder source; diff --git a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/AbstractBulkIndexByScrollRequestBuilder.java b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/AbstractBulkIndexByScrollRequestBuilder.java index 795ca8c9f41..9afe96b3656 100644 --- a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/AbstractBulkIndexByScrollRequestBuilder.java +++ b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/AbstractBulkIndexByScrollRequestBuilder.java @@ -25,7 +25,10 @@ import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.script.Script; -public abstract class AbstractBulkIndexByScrollRequestBuilder, Response extends ActionResponse, Self extends AbstractBulkIndexByScrollRequestBuilder> +public abstract class AbstractBulkIndexByScrollRequestBuilder< + Request extends AbstractBulkIndexByScrollRequest, + Response extends ActionResponse, + Self extends AbstractBulkIndexByScrollRequestBuilder> extends AbstractBulkByScrollRequestBuilder { protected AbstractBulkIndexByScrollRequestBuilder(ElasticsearchClient client, diff --git a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/BulkByScrollTask.java b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/BulkByScrollTask.java index 2561520fe2e..411e9bb9dc3 100644 --- a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/BulkByScrollTask.java +++ b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/BulkByScrollTask.java @@ -19,7 +19,6 @@ package org.elasticsearch.plugin.reindex; -import org.elasticsearch.common.inject.Provider; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -46,7 +45,7 @@ public class BulkByScrollTask extends Task { private final AtomicLong versionConflicts = new AtomicLong(0); private final AtomicLong retries = new AtomicLong(0); - public BulkByScrollTask(long id, String type, String action, Provider description) { + public BulkByScrollTask(long id, String type, String action, String description) { super(id, type, action, description); } diff --git a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/RestReindexAction.java b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/RestReindexAction.java index b19f86e4fbb..c4dadf3e4ef 100644 --- a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/RestReindexAction.java +++ b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/RestReindexAction.java @@ -87,7 +87,8 @@ public class RestReindexAction extends AbstractBaseReindexRestHandler i.ttl(parseTimeValue(ttl, TimeValue.timeValueMillis(-1), "ttl").millis()), new ParseField("ttl")); + destParser.declareString((i, ttl) -> i.ttl(parseTimeValue(ttl, TimeValue.timeValueMillis(-1), "ttl").millis()), + new ParseField("ttl")); PARSER.declareField((p, v, c) -> sourceParser.parse(p, v.getSource(), c), new ParseField("source"), ValueType.OBJECT); PARSER.declareField((p, v, c) -> destParser.parse(p, v.getDestination(), null), new ParseField("dest"), ValueType.OBJECT); diff --git a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/TransportReindexAction.java b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/TransportReindexAction.java index acb9b0fe4fc..4381bf223eb 100644 --- a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/TransportReindexAction.java +++ b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/TransportReindexAction.java @@ -115,8 +115,8 @@ public class TransportReindexAction extends HandledTransportAction { - public AsyncIndexBySearchAction(BulkByScrollTask task, ESLogger logger, ScriptService scriptService, Client client, ThreadPool threadPool, - ReindexRequest request, ActionListener listener) { + public AsyncIndexBySearchAction(BulkByScrollTask task, ESLogger logger, ScriptService scriptService, Client client, + ThreadPool threadPool, ReindexRequest request, ActionListener listener) { super(task, logger, scriptService, client, threadPool, request, request.getSource(), listener); } diff --git a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/TransportUpdateByQueryAction.java b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/TransportUpdateByQueryAction.java index 46140c64301..cb03fabc70a 100644 --- a/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/TransportUpdateByQueryAction.java +++ b/plugins/reindex/src/main/java/org/elasticsearch/plugin/reindex/TransportUpdateByQueryAction.java @@ -76,8 +76,8 @@ public class TransportUpdateByQueryAction extends HandledTransportAction { - public AsyncIndexBySearchAction(BulkByScrollTask task, ESLogger logger, ScriptService scriptService, Client client, ThreadPool threadPool, - UpdateByQueryRequest request, ActionListener listener) { + public AsyncIndexBySearchAction(BulkByScrollTask task, ESLogger logger, ScriptService scriptService, Client client, + ThreadPool threadPool, UpdateByQueryRequest request, ActionListener listener) { super(task, logger, scriptService, client, threadPool, request, request.getSource(), listener); } diff --git a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexByScrollActionScriptTestCase.java b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexByScrollActionScriptTestCase.java index d2c91fe4a20..cf7f1e91fe9 100644 --- a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexByScrollActionScriptTestCase.java +++ b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexByScrollActionScriptTestCase.java @@ -34,7 +34,9 @@ import java.util.function.Consumer; import static java.util.Collections.singletonMap; import static org.hamcrest.Matchers.equalTo; -public abstract class AbstractAsyncBulkIndexByScrollActionScriptTestCase, Response extends BulkIndexByScrollResponse> +public abstract class AbstractAsyncBulkIndexByScrollActionScriptTestCase< + Request extends AbstractBulkIndexByScrollRequest, + Response extends BulkIndexByScrollResponse> extends AbstractAsyncBulkIndexByScrollActionTestCase { protected IndexRequest applyScript(Consumer> scriptBody) { IndexRequest index = new IndexRequest("index", "type", "1").source(singletonMap("foo", "bar")); diff --git a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexByScrollActionTestCase.java b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexByScrollActionTestCase.java index 65ba0c79908..74b466d9363 100644 --- a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexByScrollActionTestCase.java +++ b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexByScrollActionTestCase.java @@ -25,7 +25,9 @@ import org.elasticsearch.threadpool.ThreadPool; import org.junit.After; import org.junit.Before; -public abstract class AbstractAsyncBulkIndexByScrollActionTestCase, Response extends BulkIndexByScrollResponse> +public abstract class AbstractAsyncBulkIndexByScrollActionTestCase< + Request extends AbstractBulkIndexByScrollRequest, + Response extends BulkIndexByScrollResponse> extends ESTestCase { protected ThreadPool threadPool; protected BulkByScrollTask task; @@ -33,7 +35,7 @@ public abstract class AbstractAsyncBulkIndexByScrollActionTestCase "test"); + task = new BulkByScrollTask(1, "test", "test", "test"); } @After diff --git a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexbyScrollActionMetadataTestCase.java b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexbyScrollActionMetadataTestCase.java index 5718bf3910c..420a460500b 100644 --- a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexbyScrollActionMetadataTestCase.java +++ b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractAsyncBulkIndexbyScrollActionMetadataTestCase.java @@ -32,7 +32,9 @@ import static java.util.Collections.singletonList; import static java.util.Collections.singletonMap; import static org.elasticsearch.common.unit.TimeValue.timeValueMillis; -public abstract class AbstractAsyncBulkIndexbyScrollActionMetadataTestCase, Response extends BulkIndexByScrollResponse> +public abstract class AbstractAsyncBulkIndexbyScrollActionMetadataTestCase< + Request extends AbstractBulkIndexByScrollRequest, + Response extends BulkIndexByScrollResponse> extends AbstractAsyncBulkIndexByScrollActionTestCase { /** diff --git a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractBulkIndexByScrollResponseMatcher.java b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractBulkIndexByScrollResponseMatcher.java index 50925c40834..cd2986b5015 100644 --- a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractBulkIndexByScrollResponseMatcher.java +++ b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AbstractBulkIndexByScrollResponseMatcher.java @@ -25,7 +25,9 @@ import org.hamcrest.TypeSafeMatcher; import static org.hamcrest.Matchers.equalTo; -public abstract class AbstractBulkIndexByScrollResponseMatcher> +public abstract class AbstractBulkIndexByScrollResponseMatcher< + Response extends BulkIndexByScrollResponse, + Self extends AbstractBulkIndexByScrollResponseMatcher> extends TypeSafeMatcher { private Matcher updatedMatcher = equalTo(0L); /** diff --git a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AsyncBulkByScrollActionTests.java b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AsyncBulkByScrollActionTests.java index b724c4f5d36..939a0d7a4a4 100644 --- a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AsyncBulkByScrollActionTests.java +++ b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/AsyncBulkByScrollActionTests.java @@ -99,7 +99,7 @@ public class AsyncBulkByScrollActionTests extends ESTestCase { firstSearchRequest = null; listener = new PlainActionFuture<>(); scrollId = null; - task = new BulkByScrollTask(0, "test", "test", () -> "test"); + task = new BulkByScrollTask(0, "test", "test", "test"); } @After diff --git a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/BulkByScrollTaskTests.java b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/BulkByScrollTaskTests.java index ab2ac9bf0e0..a59515407c9 100644 --- a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/BulkByScrollTaskTests.java +++ b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/BulkByScrollTaskTests.java @@ -27,7 +27,7 @@ public class BulkByScrollTaskTests extends ESTestCase { @Before public void createTask() { - task = new BulkByScrollTask(1, "test_type", "test_action", () -> "test"); + task = new BulkByScrollTask(1, "test_type", "test_action", "test"); } public void testBasicData() { diff --git a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/UpdateByQueryWhileModifyingTests.java b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/UpdateByQueryWhileModifyingTests.java index 57d80c9fe0d..a739ecf4654 100644 --- a/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/UpdateByQueryWhileModifyingTests.java +++ b/plugins/reindex/src/test/java/org/elasticsearch/plugin/reindex/UpdateByQueryWhileModifyingTests.java @@ -77,7 +77,8 @@ public class UpdateByQueryWhileModifyingTests extends UpdateByQueryTestCase { break; } catch (VersionConflictEngineException e) { if (attempts >= MAX_ATTEMPTS) { - throw new RuntimeException("Failed to index after [" + MAX_ATTEMPTS + "] attempts. Too many version conflicts!"); + throw new RuntimeException( + "Failed to index after [" + MAX_ATTEMPTS + "] attempts. Too many version conflicts!"); } logger.info( "Caught expected version conflict trying to perform mutation number {} with version {}. Retrying.",