- All Implemented Interfaces:
public class DeleteByQueryRequest extends AbstractBulkByScrollRequest<DeleteByQueryRequest> implements IndicesRequest.Replaceable, ToXContentObject
Creates a new
DeleteByQueryRequestthat uses scrolling and bulk requests to delete all documents matching the query. This can have performance as well as visibility implications. Delete-by-query now has the following semantics:
non-atomic, a delete-by-query may fail at any time while some documents matching the query have already been deleted
syntactic sugar, a delete-by-query is equivalent to a scroll search and corresponding bulk-deletes by ID
- it's executed on a
point-in-timesnapshot, a delete-by-query will only delete the documents that are visible at the point in time the delete-by-query was started, equivalent to the scroll API
consistent, a delete-by-query will yield consistent results across all replicas of a shard
forward-compatible, a delete-by-query will only send IDs to the shards as deletes such that no queries are stored in the transaction logs that might not be supported in the future.
- it's results won't be visible until the index is refreshed.
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.transport.TransportRequest
Nested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
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
Method SummaryModifier and TypeMethodDescriptionBuild a new request for a slice of the parent request.
intGets the batch size for this requestDeprecated.Types are in the process of being removed.Gets the routing value used for this request
indices()Returns the array of indices that the action relates toSets the indices that the action relates to.Returns the indices options used to resolve indices.
self()`this` cast to Self.
(int size)The scroll size to control number of documents processed per batchDeprecated.Types are in the process of being removed.Set the IndicesOptions for controlling unavailable indicesSet the query for selective deleteSet routing limiting the process to the shards that match that routing value
types()Deprecated.Types are in the process of being removed.Deprecated.Types are in the process of being removed.
Methods inherited from class org.elasticsearch.index.reindex.AbstractBulkByScrollRequest
createTask, doForSlice, getDescription, getMaxDocs, getMaxRetries, getRequestsPerSecond, getRetryBackoffInitialTime, getScrollTime, getSearchRequest, getShouldStoreResult, getSize, getSlices, getTimeout, getWaitForActiveShards, isAbortOnVersionConflict, isRefresh, searchToString, setAbortOnVersionConflict, setConflicts, setMaxDocs, setMaxRetries, setRefresh, setRequestsPerSecond, setRetryBackoffInitialTime, setScroll, setShouldStoreResult, setSize, setSlices, setTimeout, setTimeout, setWaitForActiveShards, setWaitForActiveShards, writeTo
Methods inherited from class org.elasticsearch.transport.TransportRequest
Methods inherited from class org.elasticsearch.transport.TransportMessage
decRef, hasReferences, 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.action.IndicesRequest.Replaceable
setQuerySet the query for selective delete
setDocTypesDeprecated.Types are in the process of being removed. Instead of using a type, prefer to filter on a field of the document.Set the document types for the delete
setRoutingSet routing limiting the process to the shards that match that routing value
setBatchSizepublic DeleteByQueryRequest setBatchSize
(int size)The scroll size to control number of documents processed per batch
setIndicesOptionsSet the IndicesOptions for controlling unavailable indices
getBatchSizepublic int getBatchSize()Gets the batch size for this request
getRoutingpublic String getRouting()Gets the routing value used for this request
getDocTypesDeprecated.Types are in the process of being removed. Instead of using a type, prefer to filter on a field of the document.Gets the document types on which this request would be executed. Returns an empty array if all types are to be processed.
selfprotected DeleteByQueryRequest self()Description copied from class:
AbstractBulkByScrollRequest`this` cast to Self. Used for building fluent methods without cast warnings.
validatepublic ActionRequestValidationException validate()
forSliceDescription copied from class:
AbstractBulkByScrollRequestBuild a new request for a slice of the parent request.
toStringpublic String toString()
indicesDescription copied from interface:
IndicesRequest.ReplaceableSets the indices that the action relates to.
indicespublic String indices()Description copied from interface:
IndicesRequestReturns the array of indices that the action relates to
indicesOptionspublic 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.
typesDeprecated.Types are in the process of being removed. Instead of using a type, prefer to filter on a field of the document.Gets the document types on which this request would be executed.
typesSet the document types for the delete
toXContentpublic XContentBuilder toXContent
(XContentBuilder builder, ToXContent.Params params) throws IOException