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.Empty
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, 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
-
Constructor Summary
Constructors Constructor Description ReindexRequest()
ReindexRequest(StreamInput in)
-
Method Summary
Modifier and Type Method Description ReindexRequest
addSortField(java.lang.String name, SortOrder order)
Deprecated.Specifying a sort field for reindex is deprecated.ReindexRequest
forSlice(TaskId slicingTask, SearchRequest slice, int totalSlices)
Build a new request for a slice of the parent request.static ReindexRequest
fromXContent(XContentParser parser)
IndexRequest
getDestination()
Gets the target for this reindex request in the for of anIndexRequest
RemoteInfo
getRemoteInfo()
Get theRemoteInfo
if it was set for this request.protected ReindexRequest
self()
`this` cast to Self.ReindexRequest
setDestDocType(java.lang.String docType)
Set the document type for the destination indexReindexRequest
setDestIndex(java.lang.String destIndex)
Set the target index for the ReindexRequestReindexRequest
setDestOpType(java.lang.String opType)
Sets the optype on the destination indexvoid
setDestPipeline(java.lang.String pipelineName)
Allows to set the ingest pipeline for the target index.ReindexRequest
setDestRouting(java.lang.String routing)
Set the routing to decide which shard the documents need to be routed toReindexRequest
setDestVersionType(VersionType versionType)
Set the version type for the target index.ReindexRequest
setRemoteInfo(RemoteInfo remoteInfo)
Set theRemoteInfo
if the source indices are in a remote cluster.ReindexRequest
setSourceBatchSize(int size)
Sets the scroll size for setting how many documents are to be processed in one batch during reindexReindexRequest
setSourceDocTypes(java.lang.String... docTypes)
Set the document types which need to be copied from the source indicesReindexRequest
setSourceIndices(java.lang.String... sourceIndices)
Set the indices which will act as the source for the ReindexRequestReindexRequest
setSourceQuery(QueryBuilder queryBuilder)
Set the query for selecting documents from the source indicesjava.lang.String
toString()
XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
ActionRequestValidationException
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
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:
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
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 theRemoteInfo
if the source indices are in a remote cluster. -
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:
java.io.IOException
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
fromXContent
- Throws:
java.io.IOException
-