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
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentObject
,org.elasticsearch.core.RefCounted
,TaskAwareRequest
public class ReindexRequest
extends AbstractBulkIndexByScrollRequest<ReindexRequest>
implements CompositeIndicesRequest, org.elasticsearch.common.xcontent.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.Empty
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
Nested 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
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddSortField(String name, SortOrder order)
Deprecated.Specifying a sort field for reindex is deprecated.forSlice(TaskId slicingTask, SearchRequest slice, int totalSlices)
Build a new request for a slice of the parent request.static ReindexRequest
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
Gets the target for this reindex request in the for of anIndexRequest
Get theRemoteInfo
if it was set for this request.protected ReindexRequest
self()
`this` cast to Self.setDestDocType(String docType)
Set the document type for the destination indexsetDestIndex(String destIndex)
Set the target index for the ReindexRequestsetDestOpType(String opType)
Sets the optype on the destination indexvoid
setDestPipeline(String pipelineName)
Allows to set the ingest pipeline for the target index.setDestRouting(String routing)
Set the routing to decide which shard the documents need to be routed tosetDestVersionType(VersionType versionType)
Set the version type for the target index.setRemoteInfo(RemoteInfo remoteInfo)
Set theRemoteInfo
if the source indices are in a remote cluster.setRequireAlias(boolean requireAlias)
Sets the require_alias request flag on the destination indexsetSourceBatchSize(int size)
Sets the scroll size for setting how many documents are to be processed in one batch during reindexsetSourceDocTypes(String... docTypes)
Set the document types which need to be copied from the source indicessetSourceIndices(String... sourceIndices)
Set the indices which will act as the source for the ReindexRequestsetSourceQuery(QueryBuilder queryBuilder)
Set the query for selecting documents from the source indicestoString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
validate()
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class org.elasticsearch.index.reindex.AbstractBulkIndexByScrollRequest
doForSlice, getScript, searchToString, setScript
Methods 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, setWaitForActiveShards
Methods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTask
Methods inherited from class org.elasticsearch.transport.TransportMessage
decRef, incRef, remoteAddress, remoteAddress, tryIncRef
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
setParentTask
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
Constructor Details
-
ReindexRequest
public ReindexRequest() -
ReindexRequest
- Throws:
IOException
-
-
Method Details
-
self
Description copied from class:AbstractBulkByScrollRequest
`this` cast to Self. Used for building fluent methods without cast warnings.- Specified by:
self
in classAbstractBulkByScrollRequest<ReindexRequest>
-
validate
- Overrides:
validate
in 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.EXTERNAL
helps preserve the version if the document already existed in the target index. -
setDestPipeline
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 theRemoteInfo
if the source indices are in a remote cluster. -
setRequireAlias
Sets the require_alias request flag on the destination index -
getDestination
Gets the target for this reindex request in the for of anIndexRequest
-
getRemoteInfo
Get theRemoteInfo
if it was set for this request. -
forSlice
Description copied from class:AbstractBulkByScrollRequest
Build a new request for a slice of the parent request.- Specified by:
forSlice
in classAbstractBulkByScrollRequest<ReindexRequest>
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Overrides:
writeTo
in classAbstractBulkIndexByScrollRequest<ReindexRequest>
- Throws:
IOException
-
toString
- Overrides:
toString
in classTransportRequest
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
IOException
-
fromXContent
public static ReindexRequest fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException- Throws:
IOException
-