Package org.elasticsearch.index.reindex
Class UpdateByQueryRequest
- 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<UpdateByQueryRequest>
-
- org.elasticsearch.index.reindex.UpdateByQueryRequest
-
- All Implemented Interfaces:
IndicesRequest,IndicesRequest.Replaceable,Streamable,Writeable,ToXContent,ToXContentObject,TaskAwareRequest
public class UpdateByQueryRequest extends AbstractBulkIndexByScrollRequest<UpdateByQueryRequest> implements IndicesRequest.Replaceable, ToXContentObject
Request to update some documents. That means you can't change their type, id, index, or anything like that. 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 but better than ReindexRequest because scripts can't change the destination index and things.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.transport.TransportRequest
TransportRequest.Empty
-
Nested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.Replaceable
-
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, SIZE_ALL_MATCHES
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description UpdateByQueryRequest()UpdateByQueryRequest(java.lang.String... indices)UpdateByQueryRequest(StreamInput in)
-
Method Summary
Modifier and Type Method Description UpdateByQueryRequestforSlice(TaskId slicingTask, SearchRequest slice, int totalSlices)Build a new request for a slice of the parent request.intgetBatchSize()Gets the batch size for this requestjava.lang.String[]getDocTypes()Gets the document types on which this request would be executed.java.lang.StringgetPipeline()Ingest pipeline to set on index requests made by this action.java.lang.StringgetRouting()Gets the routing value used for this requestjava.lang.String[]indices()Returns the array of indices that the action relates toIndicesRequestindices(java.lang.String... indices)Sets the indices that the action relates to.IndicesOptionsindicesOptions()Returns the indices options used to resolve indices.voidreadFrom(StreamInput in)Set this object's fields from a StreamInput.protected UpdateByQueryRequestself()`this` cast to Self.UpdateByQueryRequestsetBatchSize(int size)The scroll size to control number of documents processed per batchUpdateByQueryRequestsetDocTypes(java.lang.String... types)Set the document types for the updateUpdateByQueryRequestsetIndicesOptions(IndicesOptions indicesOptions)Set the IndicesOptions for controlling unavailable indicesUpdateByQueryRequestsetPipeline(java.lang.String pipeline)Set the ingest pipeline to set on index requests made by this action.UpdateByQueryRequestsetQuery(QueryBuilder query)Set the query for selective updateUpdateByQueryRequestsetRouting(java.lang.String routing)Set routing limiting the process to the shards that match that routing valuejava.lang.StringtoString()XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)voidwriteTo(StreamOutput out)Write this object's fields to a 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, getMaxRetries, getRequestsPerSecond, getRetryBackoffInitialTime, getScrollTime, getSearchRequest, getShouldStoreResult, getSize, getSlices, getTimeout, getWaitForActiveShards, isAbortOnVersionConflict, isRefresh, setAbortOnVersionConflict, setConflicts, setMaxRetries, setRefresh, setRequestsPerSecond, setRetryBackoffInitialTime, setScroll, setShouldStoreResult, setSize, setSlices, setTimeout, setTimeout, setWaitForActiveShards, setWaitForActiveShards, validate
-
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, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
setParentTask
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Constructor Detail
-
UpdateByQueryRequest
public UpdateByQueryRequest()
-
UpdateByQueryRequest
public UpdateByQueryRequest(java.lang.String... indices)
-
UpdateByQueryRequest
public UpdateByQueryRequest(StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
setPipeline
public UpdateByQueryRequest setPipeline(java.lang.String pipeline)
Set the ingest pipeline to set on index requests made by this action.
-
setQuery
public UpdateByQueryRequest setQuery(QueryBuilder query)
Set the query for selective update
-
setDocTypes
public UpdateByQueryRequest setDocTypes(java.lang.String... types)
Set the document types for the update
-
setRouting
public UpdateByQueryRequest setRouting(java.lang.String routing)
Set routing limiting the process to the shards that match that routing value
-
setBatchSize
public UpdateByQueryRequest setBatchSize(int size)
The scroll size to control number of documents processed per batch
-
setIndicesOptions
public UpdateByQueryRequest setIndicesOptions(IndicesOptions indicesOptions)
Set the IndicesOptions for controlling unavailable indices
-
getBatchSize
public int getBatchSize()
Gets the batch size for this request
-
getRouting
public java.lang.String getRouting()
Gets the routing value used for this request
-
getDocTypes
public java.lang.String[] getDocTypes()
Gets the document types on which this request would be executed. Returns an empty array if all types are to be processed.
-
getPipeline
public java.lang.String getPipeline()
Ingest pipeline to set on index requests made by this action.
-
self
protected UpdateByQueryRequest self()
Description copied from class:AbstractBulkByScrollRequest`this` cast to Self. Used for building fluent methods without cast warnings.- Specified by:
selfin classAbstractBulkByScrollRequest<UpdateByQueryRequest>
-
forSlice
public UpdateByQueryRequest forSlice(TaskId slicingTask, SearchRequest slice, int totalSlices)
Description copied from class:AbstractBulkByScrollRequestBuild a new request for a slice of the parent request.- Specified by:
forSlicein classAbstractBulkByScrollRequest<UpdateByQueryRequest>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
indices
public IndicesRequest indices(java.lang.String... indices)
Description copied from interface:IndicesRequest.ReplaceableSets the indices that the action relates to.- Specified by:
indicesin interfaceIndicesRequest.Replaceable
-
indices
public java.lang.String[] indices()
Description copied from interface:IndicesRequestReturns the array of indices that the action relates to- Specified by:
indicesin interfaceIndicesRequest
-
indicesOptions
public IndicesOptions indicesOptions()
Description copied from interface:IndicesRequestReturns the indices options used to resolve indices. They tell for instance whether a single index is accepted, whether an empty array will be converted to _all, and how wildcards will be expanded if needed.- Specified by:
indicesOptionsin interfaceIndicesRequest
-
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 classAbstractBulkIndexByScrollRequest<UpdateByQueryRequest>- 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 classAbstractBulkIndexByScrollRequest<UpdateByQueryRequest>- Throws:
java.io.IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContentin interfaceToXContent- Throws:
java.io.IOException
-
-