result = getOrReplaceAllIndices(((ReindexRequest) request).getDestination(), provider, false) && result; result = getOrReplaceAllIndices(((ReindexRequest) request).getSearchRequest(), provider, false) && result; } else if (request instanceof BaseNodesRequest) {
/** * Set the version type for the target index. A {@link VersionType#EXTERNAL} helps preserve the version * if the document already existed in the target index. */ public ReindexRequest setDestVersionType(VersionType versionType) { this.getDestination().versionType(versionType); return this; }
/** * Set the target index for the ReindexRequest */ public ReindexRequest setDestIndex(String destIndex) { if (destIndex != null) { this.getDestination().index(destIndex); } return this; }
/** * Set the document type for the destination index */ public ReindexRequest setDestDocType(String docType) { this.getDestination().type(docType); return this; }
/** * Set the routing to decide which shard the documents need to be routed to */ public ReindexRequest setDestRouting(String routing) { this.getDestination().routing(routing); return this; }
/** * Sets the optype on the destination index * @param opType must be one of {create, index} */ public ReindexRequest setDestOpType(String opType) { this.getDestination().opType(opType); return this; }
/** * Allows to set the ingest pipeline for the target index. */ public void setDestPipeline(String pipelineName) { this.getDestination().setPipeline(pipelineName); }
builder.field("index", getDestination().index()); if (getDestination().type() != null) { builder.field("type", getDestination().type()); if (getDestination().routing() != null) { builder.field("routing", getDestination().routing()); builder.field("op_type", getDestination().opType().getLowercase()); if (getDestination().getPipeline() != null) { builder.field("pipeline", getDestination().getPipeline()); builder.field("version_type", VersionType.toString(getDestination().versionType())); builder.endObject();
@Override protected boolean needsSourceDocumentVersions() { /* * We only need the source version if we're going to use it when write and we only do that when the destination request uses * external versioning. */ return mainRequest.getDestination().versionType() != VersionType.INTERNAL; }
/** * Set the routing to decide which shard the documents need to be routed to */ public ReindexRequest setDestRouting(String routing) { this.getDestination().routing(routing); return this; }
/** * Set the version type for the target index. A {@link VersionType#EXTERNAL} helps preserve the version * if the document already existed in the target index. */ public ReindexRequest setDestVersionType(VersionType versionType) { this.getDestination().versionType(versionType); return this; }
/** * Allows to set the ingest pipeline for the target index. */ public void setDestPipeline(String pipelineName) { this.getDestination().setPipeline(pipelineName); }
/** * Set the target index for the ReindexRequest */ public ReindexRequest setDestIndex(String destIndex) { if (destIndex != null) { this.getDestination().index(destIndex); } return this; }
/** * Set the document type for the destination index */ public ReindexRequest setDestDocType(String docType) { this.getDestination().type(docType); return this; }
/** * Sets the optype on the destination index * @param opType must be one of {create, index} */ public ReindexRequest setDestOpType(String opType) { this.getDestination().opType(opType); return this; }
/** * Accessor to get the underlying {@link IndicesRequest}s that this request wraps. Note that this method is <strong>not * accurate</strong> since it returns a prototype {@link IndexRequest} and not the actual requests that will be issued as part of the * execution of this request. Additionally, scripts can modify the underlying {@link IndexRequest} and change values such as the index, * type, {@link org.elasticsearch.action.support.IndicesOptions}. In short - only use this for very course reasoning about the request. * * @return a list comprising of the {@link SearchRequest} and the prototype {@link IndexRequest} */ @Override public List<? extends IndicesRequest> subRequests() { assert getSearchRequest() != null; assert getDestination() != null; return Collections.<IndicesRequest>unmodifiableList(Arrays.asList(getSearchRequest(), getDestination())); } }
/** * Accessor to get the underlying {@link IndicesRequest}s that this request wraps. Note that this method is <strong>not * accurate</strong> since it returns a prototype {@link IndexRequest} and not the actual requests that will be issued as part of the * execution of this request. Additionally, scripts can modify the underlying {@link IndexRequest} and change values such as the index, * type, {@link org.elasticsearch.action.support.IndicesOptions}. In short - only use this for very course reasoning about the request. * * @return a list comprising of the {@link SearchRequest} and the prototype {@link IndexRequest} */ @Override public List<? extends IndicesRequest> subRequests() { assert getSearchRequest() != null; assert getDestination() != null; return Collections.<IndicesRequest>unmodifiableList(Arrays.asList(getSearchRequest(), getDestination())); } }
@Override protected void doExecute(Task task, ReindexRequest request, ActionListener<ReindexResponse> listener) { validateAgainstAliases(request.getSearchRequest(), request.getDestination(), indexNameExpressionResolver, autoCreateIndex, clusterService.state()); new AsyncIndexBySearchAction((BulkByScrollTask) task, logger, scriptService, client, threadPool, clusterService.state().nodes().smallestNonClientNodeVersion(), request, listener).start(); }
@Override protected void doExecute(Task task, ReindexRequest request, ActionListener<ReindexResponse> listener) { validateAgainstAliases(request.getSearchRequest(), request.getDestination(), indexNameExpressionResolver, autoCreateIndex, clusterService.state()); new AsyncIndexBySearchAction((BulkByScrollTask) task, logger, scriptService, client, threadPool, clusterService.state().nodes().smallestNonClientNodeVersion(), request, listener).start(); }
@Override protected void doExecute(Task task, ReindexRequest request, ActionListener<BulkByScrollResponse> listener) { checkRemoteWhitelist(remoteWhitelist, request.getRemoteInfo()); ClusterState state = clusterService.state(); validateAgainstAliases(request.getSearchRequest(), request.getDestination(), request.getRemoteInfo(), indexNameExpressionResolver, autoCreateIndex, state); BulkByScrollTask bulkByScrollTask = (BulkByScrollTask) task; BulkByScrollParallelizationHelper.startSlicedAction(request, bulkByScrollTask, ReindexAction.INSTANCE, listener, client, clusterService.localNode(), () -> { ParentTaskAssigningClient assigningClient = new ParentTaskAssigningClient(client, clusterService.localNode(), bulkByScrollTask); new AsyncIndexBySearchAction(bulkByScrollTask, logger, assigningClient, threadPool, request, scriptService, state, listener).start(); } ); }