Package org.elasticsearch.index.reindex
Class AbstractBulkByScrollRequest<Self extends AbstractBulkByScrollRequest<Self>>
- java.lang.Object
-
- org.elasticsearch.transport.TransportMessage
-
- org.elasticsearch.transport.TransportRequest
-
- org.elasticsearch.action.ActionRequest
-
- org.elasticsearch.index.reindex.AbstractBulkByScrollRequest<Self>
-
- All Implemented Interfaces:
Streamable,Writeable,TaskAwareRequest
- Direct Known Subclasses:
AbstractBulkIndexByScrollRequest,DeleteByQueryRequest
public abstract class AbstractBulkByScrollRequest<Self extends AbstractBulkByScrollRequest<Self>> extends ActionRequest
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.transport.TransportRequest
TransportRequest.Empty
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Field Summary
Fields Modifier and Type Field Description static intAUTO_SLICESstatic java.lang.StringAUTO_SLICES_VALUEstatic intDEFAULT_SCROLL_SIZEstatic TimeValueDEFAULT_SCROLL_TIMEOUTstatic intSIZE_ALL_MATCHES
-
Constructor Summary
Constructors Constructor Description AbstractBulkByScrollRequest()Constructor for deserialization.AbstractBulkByScrollRequest(SearchRequest searchRequest, boolean setDefaults)Constructor for actual use.
-
Method Summary
Modifier and Type Method Description TaskcreateTask(long id, java.lang.String type, java.lang.String action, TaskId parentTaskId, java.util.Map<java.lang.String,java.lang.String> headers)Returns the task object that should be used to keep track of the processing of the request.protected SelfdoForSlice(Self request, TaskId slicingTask, int totalSlices)Setup a clone of this request with the information needed to process a slice of it.abstract SelfforSlice(TaskId slicingTask, SearchRequest slice, int totalSlices)Build a new request for a slice of the parent request.java.lang.StringgetDescription()Returns optional description of the request to be displayed by the task managerintgetMaxRetries()Total number of retries attempted for rejections.floatgetRequestsPerSecond()The throttle for this request in sub-requests per second.TimeValuegetRetryBackoffInitialTime()Initial delay after a rejection before retrying request.TimeValuegetScrollTime()Get scroll timeoutSearchRequestgetSearchRequest()The search request that matches the documents to process.booleangetShouldStoreResult()Should this task store its result after it has finished?intgetSize()Maximum number of processed documents.intgetSlices()The number of slices this task should be divided into.TimeValuegetTimeout()Timeout to wait for the shards on to be available for each bulk request?ActiveShardCountgetWaitForActiveShards()The number of shard copies that must be active before proceeding with the write.booleanisAbortOnVersionConflict()Whether or not version conflicts cause the action to abort.booleanisRefresh()Call refresh on the indexes we've written to after the request ends?voidreadFrom(StreamInput in)Set this object's fields from a StreamInput.protected voidsearchToString(java.lang.StringBuilder b)Append a short description of the search request to a StringBuilder.protected abstract Selfself()`this` cast to Self.SelfsetAbortOnVersionConflict(boolean abortOnVersionConflict)Set whether or not version conflicts cause the action to abort.voidsetConflicts(java.lang.String conflicts)Sets abortOnVersionConflict based on REST-friendly names.SelfsetMaxRetries(int maxRetries)Set the total number of retries attempted for rejections.SelfsetRefresh(boolean refresh)Call refresh on the indexes we've written to after the request ends?SelfsetRequestsPerSecond(float requestsPerSecond)Set the throttle for this request in sub-requests per second.SelfsetRetryBackoffInitialTime(TimeValue retryBackoffInitialTime)Set the initial delay after a rejection before retrying request.SelfsetScroll(TimeValue keepAlive)Set scroll timeout forSearchRequestSelfsetShouldStoreResult(boolean shouldStoreResult)Should this task store its result after it has finished?SelfsetSize(int size)Maximum number of processed documents.SelfsetSlices(int slices)The number of slices this task should be divided into.SelfsetTimeout(java.lang.String timeout)Timeout to wait for the shards on to be available for each bulk request?SelfsetTimeout(TimeValue timeout)Timeout to wait for the shards on to be available for each bulk request?SelfsetWaitForActiveShards(int waitForActiveShards)A shortcut forsetWaitForActiveShards(ActiveShardCount)where the numerical shard count is passed in, instead of having to first callActiveShardCount.from(int)to get the ActiveShardCount.SelfsetWaitForActiveShards(ActiveShardCount activeShardCount)Sets the number of shard copies that must be active before proceeding with the write.ActionRequestValidationExceptionvalidate()voidwriteTo(StreamOutput out)Write this object's fields to a StreamOutput.-
Methods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTask
-
Methods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddress
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
setParentTask
-
-
-
-
Field Detail
-
SIZE_ALL_MATCHES
public static final int SIZE_ALL_MATCHES
- See Also:
- Constant Field Values
-
DEFAULT_SCROLL_TIMEOUT
public static final TimeValue DEFAULT_SCROLL_TIMEOUT
-
DEFAULT_SCROLL_SIZE
public static final int DEFAULT_SCROLL_SIZE
- See Also:
- Constant Field Values
-
AUTO_SLICES
public static final int AUTO_SLICES
- See Also:
- Constant Field Values
-
AUTO_SLICES_VALUE
public static final java.lang.String AUTO_SLICES_VALUE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractBulkByScrollRequest
public AbstractBulkByScrollRequest()
Constructor for deserialization.
-
AbstractBulkByScrollRequest
public AbstractBulkByScrollRequest(SearchRequest searchRequest, boolean setDefaults)
Constructor for actual use.- Parameters:
searchRequest- the search request to execute to get the documents to processsetDefaults- should this request set the defaults on the search request? Usually set to true but leave it false to support request slicing
-
-
Method Detail
-
self
protected abstract Self self()
`this` cast to Self. Used for building fluent methods without cast warnings.
-
validate
public ActionRequestValidationException validate()
- Specified by:
validatein classActionRequest
-
getSize
public int getSize()
Maximum number of processed documents. Defaults to -1 meaning process all documents.
-
setSize
public Self setSize(int size)
Maximum number of processed documents. Defaults to -1 meaning process all documents.
-
isAbortOnVersionConflict
public boolean isAbortOnVersionConflict()
Whether or not version conflicts cause the action to abort.
-
setAbortOnVersionConflict
public Self setAbortOnVersionConflict(boolean abortOnVersionConflict)
Set whether or not version conflicts cause the action to abort.
-
setConflicts
public void setConflicts(java.lang.String conflicts)
Sets abortOnVersionConflict based on REST-friendly names.
-
getSearchRequest
public SearchRequest getSearchRequest()
The search request that matches the documents to process.
-
isRefresh
public boolean isRefresh()
Call refresh on the indexes we've written to after the request ends?
-
setRefresh
public Self setRefresh(boolean refresh)
Call refresh on the indexes we've written to after the request ends?
-
getTimeout
public TimeValue getTimeout()
Timeout to wait for the shards on to be available for each bulk request?
-
setTimeout
public Self setTimeout(TimeValue timeout)
Timeout to wait for the shards on to be available for each bulk request?
-
setTimeout
public Self setTimeout(java.lang.String timeout)
Timeout to wait for the shards on to be available for each bulk request?
-
getWaitForActiveShards
public ActiveShardCount getWaitForActiveShards()
The number of shard copies that must be active before proceeding with the write.
-
setWaitForActiveShards
public Self setWaitForActiveShards(ActiveShardCount activeShardCount)
Sets the number of shard copies that must be active before proceeding with the write. SeeReplicationRequest.waitForActiveShards(ActiveShardCount)for details.
-
setWaitForActiveShards
public Self setWaitForActiveShards(int waitForActiveShards)
A shortcut forsetWaitForActiveShards(ActiveShardCount)where the numerical shard count is passed in, instead of having to first callActiveShardCount.from(int)to get the ActiveShardCount.
-
getRetryBackoffInitialTime
public TimeValue getRetryBackoffInitialTime()
Initial delay after a rejection before retrying request.
-
setRetryBackoffInitialTime
public Self setRetryBackoffInitialTime(TimeValue retryBackoffInitialTime)
Set the initial delay after a rejection before retrying request.
-
getMaxRetries
public int getMaxRetries()
Total number of retries attempted for rejections.
-
setMaxRetries
public Self setMaxRetries(int maxRetries)
Set the total number of retries attempted for rejections. There is no way to ask for unlimited retries.
-
getRequestsPerSecond
public float getRequestsPerSecond()
The throttle for this request in sub-requests per second.Float.POSITIVE_INFINITYmeans set no throttle and that is the default. Throttling is done between batches, as we start the next scroll requests. That way we can increase the scroll's timeout to make sure that it contains any time that we might wait.
-
setRequestsPerSecond
public Self setRequestsPerSecond(float requestsPerSecond)
Set the throttle for this request in sub-requests per second.Float.POSITIVE_INFINITYmeans set no throttle and that is the default. Throttling is done between batches, as we start the next scroll requests. That way we can increase the scroll's timeout to make sure that it contains any time that we might wait.
-
setShouldStoreResult
public Self setShouldStoreResult(boolean shouldStoreResult)
Should this task store its result after it has finished?
-
getShouldStoreResult
public boolean getShouldStoreResult()
Description copied from class:ActionRequestShould this task store its result after it has finished?- Overrides:
getShouldStoreResultin classActionRequest
-
setScroll
public Self setScroll(TimeValue keepAlive)
Set scroll timeout forSearchRequest
-
getScrollTime
public TimeValue getScrollTime()
Get scroll timeout
-
setSlices
public Self setSlices(int slices)
The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks.
-
getSlices
public int getSlices()
The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks.
-
forSlice
public abstract Self forSlice(TaskId slicingTask, SearchRequest slice, int totalSlices)
Build a new request for a slice of the parent request.
-
doForSlice
protected Self doForSlice(Self request, TaskId slicingTask, int totalSlices)
Setup a clone of this request with the information needed to process a slice of it.
-
createTask
public Task createTask(long id, java.lang.String type, java.lang.String action, TaskId parentTaskId, java.util.Map<java.lang.String,java.lang.String> headers)
Description copied from interface:TaskAwareRequestReturns the task object that should be used to keep track of the processing of the request.
-
readFrom
public void readFrom(StreamInput in) throws java.io.IOException
Description copied from interface:StreamableSet this object's fields from a StreamInput.- Specified by:
readFromin interfaceStreamable- Overrides:
readFromin classActionRequest- Throws:
java.io.IOException
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:StreamableWrite this object's fields to a StreamOutput.- Specified by:
writeToin interfaceStreamable- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classActionRequest- Throws:
java.io.IOException
-
searchToString
protected void searchToString(java.lang.StringBuilder b)
Append a short description of the search request to a StringBuilder. Used to make toString.
-
getDescription
public java.lang.String getDescription()
Description copied from interface:TaskAwareRequestReturns optional description of the request to be displayed by the task manager
-
-