diff --git a/client/rest-high-level/build.gradle b/client/rest-high-level/build.gradle index e5dbf74cec5..8ec19cc8da0 100644 --- a/client/rest-high-level/build.gradle +++ b/client/rest-high-level/build.gradle @@ -103,6 +103,7 @@ integTestRunner { integTestCluster { systemProperty 'es.scripting.update.ctx_in_params', 'false' + setting 'reindex.remote.whitelist', '"[::1]:*"' setting 'xpack.license.self_generated.type', 'trial' setting 'xpack.security.enabled', 'true' setting 'xpack.security.authc.token.enabled', 'true' diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java index 6d0ceba00b5..f2f9070d27b 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java @@ -19,6 +19,7 @@ package org.elasticsearch.client.documentation; +import org.apache.http.HttpHost; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.DocWriteRequest; @@ -823,9 +824,6 @@ public class CRUDDocumentationIT extends ESRestHighLevelClientTestCase { // tag::reindex-request-conflicts request.setConflicts("proceed"); // <1> // end::reindex-request-conflicts - // tag::reindex-request-query - request.setSourceQuery(new TermQueryBuilder("user", "kimchy")); // <1> - // end::reindex-request-query // tag::reindex-request-size request.setSize(10); // <1> // end::reindex-request-size @@ -846,27 +844,29 @@ public class CRUDDocumentationIT extends ESRestHighLevelClientTestCase { "if (ctx._source.user == 'kimchy') {ctx._source.likes++;}", Collections.emptyMap())); // <1> // end::reindex-request-script + HttpHost host = getClusterHosts().get(0); + Integer remotePort = host.getPort(); + String remoteHost = host.getHostName(); + String user = "test_user"; + String password = "test-password"; + // tag::reindex-request-remote request.setRemoteInfo( new RemoteInfo( - "https", "localhost", 9002, null, + "http", remoteHost, remotePort, null, new BytesArray(new MatchAllQueryBuilder().toString()), - "user", "pass", Collections.emptyMap(), + user, password, Collections.emptyMap(), new TimeValue(100, TimeUnit.MILLISECONDS), new TimeValue(100, TimeUnit.SECONDS) ) ); // <1> // end::reindex-request-remote - request.setRemoteInfo(null); // Remove it for tests // tag::reindex-request-timeout request.setTimeout(TimeValue.timeValueMinutes(2)); // <1> // end::reindex-request-timeout // tag::reindex-request-refresh request.setRefresh(true); // <1> // end::reindex-request-refresh - // tag::reindex-request-slices - request.setSlices(2); // <1> - // end::reindex-request-slices // tag::reindex-request-scroll request.setScroll(TimeValue.timeValueMinutes(10)); // <1> // end::reindex-request-scroll @@ -904,6 +904,14 @@ public class CRUDDocumentationIT extends ESRestHighLevelClientTestCase { request.setSourceIndices("source1"); request.setDestIndex("dest"); + // These cannot be set with a remote set, so its set here instead for the docs + // tag::reindex-request-query + request.setSourceQuery(new TermQueryBuilder("user", "kimchy")); // <1> + // end::reindex-request-query + // tag::reindex-request-slices + request.setSlices(2); // <1> + // end::reindex-request-slices + ActionListener listener; // tag::reindex-execute-listener listener = new ActionListener() { diff --git a/server/src/main/java/org/elasticsearch/index/reindex/ReindexRequest.java b/server/src/main/java/org/elasticsearch/index/reindex/ReindexRequest.java index 7e5e4ea51ab..cd93356bb39 100644 --- a/server/src/main/java/org/elasticsearch/index/reindex/ReindexRequest.java +++ b/server/src/main/java/org/elasticsearch/index/reindex/ReindexRequest.java @@ -293,6 +293,7 @@ public class ReindexRequest extends AbstractBulkIndexByScrollRequest