Package org.elasticsearch.index.reindex
Class ReindexRequest
java.lang.Object
org.elasticsearch.transport.TransportMessage
org.elasticsearch.transport.TransportRequest
org.elasticsearch.action.ActionRequest
org.elasticsearch.index.reindex.AbstractBulkByScrollRequest<Self>
org.elasticsearch.index.reindex.AbstractBulkIndexByScrollRequest<ReindexRequest>
org.elasticsearch.index.reindex.ReindexRequest
- All Implemented Interfaces:
CompositeIndicesRequest,Writeable,ToXContent,ToXContentObject,TaskAwareRequest
public class ReindexRequest extends AbstractBulkIndexByScrollRequest<ReindexRequest> implements CompositeIndicesRequest, ToXContentObject
Request to reindex some documents from one index to another. This implements CompositeIndicesRequest but in a misleading way. Rather than
returning all the subrequests that it will make it tries to return a representative set of subrequests. This is best-effort for a bunch
of reasons, not least of which that scripts are allowed to change the destination request in drastic ways, including changing the index
to which documents are written.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.transport.TransportRequest
TransportRequest.EmptyNested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from class org.elasticsearch.index.reindex.AbstractBulkByScrollRequest
AUTO_SLICES, AUTO_SLICES_VALUE, DEFAULT_SCROLL_SIZE, DEFAULT_SCROLL_TIMEOUT, MAX_DOCS_ALL_MATCHES, SIZE_ALL_MATCHES -
Constructor Summary
Constructors Constructor Description ReindexRequest()ReindexRequest(StreamInput in) -
Method Summary
Modifier and Type Method Description ReindexRequestaddSortField(java.lang.String name, SortOrder order)Deprecated.Specifying a sort field for reindex is deprecated.ReindexRequestforSlice(TaskId slicingTask, SearchRequest slice, int totalSlices)Build a new request for a slice of the parent request.static ReindexRequestfromXContent(XContentParser parser)IndexRequestgetDestination()Gets the target for this reindex request in the for of anIndexRequestRemoteInfogetRemoteInfo()Get theRemoteInfoif it was set for this request.protected ReindexRequestself()`this` cast to Self.ReindexRequestsetDestDocType(java.lang.String docType)Set the document type for the destination indexReindexRequestsetDestIndex(java.lang.String destIndex)Set the target index for the ReindexRequestReindexRequestsetDestOpType(java.lang.String opType)Sets the optype on the destination indexvoidsetDestPipeline(java.lang.String pipelineName)Allows to set the ingest pipeline for the target index.ReindexRequestsetDestRouting(java.lang.String routing)Set the routing to decide which shard the documents need to be routed toReindexRequestsetDestVersionType(VersionType versionType)Set the version type for the target index.ReindexRequestsetRemoteInfo(RemoteInfo remoteInfo)Set theRemoteInfoif the source indices are in a remote cluster.ReindexRequestsetSourceBatchSize(int size)Sets the scroll size for setting how many documents are to be processed in one batch during reindexReindexRequestsetSourceDocTypes(java.lang.String... docTypes)Set the document types which need to be copied from the source indicesReindexRequestsetSourceIndices(java.lang.String... sourceIndices)Set the indices which will act as the source for the ReindexRequestReindexRequestsetSourceQuery(QueryBuilder queryBuilder)Set the query for selecting documents from the source indicesjava.lang.StringtoString()XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)ActionRequestValidationExceptionvalidate()voidwriteTo(StreamOutput out)Write this into the StreamOutput.Methods inherited from class org.elasticsearch.index.reindex.AbstractBulkIndexByScrollRequest
doForSlice, getScript, searchToString, setScriptMethods inherited from class org.elasticsearch.index.reindex.AbstractBulkByScrollRequest
createTask, getDescription, getMaxDocs, getMaxRetries, getRequestsPerSecond, getRetryBackoffInitialTime, getScrollTime, getSearchRequest, getShouldStoreResult, getSize, getSlices, getTimeout, getWaitForActiveShards, isAbortOnVersionConflict, isRefresh, setAbortOnVersionConflict, setConflicts, setMaxDocs, setMaxRetries, setRefresh, setRequestsPerSecond, setRetryBackoffInitialTime, setScroll, setShouldStoreResult, setSize, setSlices, setTimeout, setTimeout, setWaitForActiveShards, setWaitForActiveShardsMethods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTaskMethods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddress
-
Constructor Details
-
ReindexRequest
public ReindexRequest() -
ReindexRequest
- Throws:
java.io.IOException
-
-
Method Details
-
self
Description copied from class:AbstractBulkByScrollRequest`this` cast to Self. Used for building fluent methods without cast warnings.- Specified by:
selfin classAbstractBulkByScrollRequest<ReindexRequest>
-
validate
- Overrides:
validatein classAbstractBulkByScrollRequest<ReindexRequest>
-
setSourceIndices
Set the indices which will act as the source for the ReindexRequest -
setSourceDocTypes
Set the document types which need to be copied from the source indices -
setSourceBatchSize
Sets the scroll size for setting how many documents are to be processed in one batch during reindex -
setSourceQuery
Set the query for selecting documents from the source indices -
addSortField
Deprecated.Specifying a sort field for reindex is deprecated. If using this in combination with maxDocs, consider using a query filter instead.Add a sort against the given field name.- Parameters:
name- The name of the field to sort byorder- The order in which to sort
-
setDestIndex
Set the target index for the ReindexRequest -
setDestDocType
Set the document type for the destination index -
setDestRouting
Set the routing to decide which shard the documents need to be routed to -
setDestVersionType
Set the version type for the target index. AVersionType.EXTERNALhelps preserve the version if the document already existed in the target index. -
setDestPipeline
public void setDestPipeline(java.lang.String pipelineName)Allows to set the ingest pipeline for the target index. -
setDestOpType
Sets the optype on the destination index- Parameters:
opType- must be one of {create, index}
-
setRemoteInfo
Set theRemoteInfoif the source indices are in a remote cluster. -
getDestination
Gets the target for this reindex request in the for of anIndexRequest -
getRemoteInfo
Get theRemoteInfoif it was set for this request. -
forSlice
Description copied from class:AbstractBulkByScrollRequestBuild a new request for a slice of the parent request.- Specified by:
forSlicein classAbstractBulkByScrollRequest<ReindexRequest>
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classAbstractBulkIndexByScrollRequest<ReindexRequest>- Throws:
java.io.IOException
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceToXContent- Throws:
java.io.IOException
-
fromXContent
- Throws:
java.io.IOException
-