- All Implemented Interfaces:
org.apache.lucene.util.Accountable,CompositeIndicesRequest,DocWriteRequest<DeleteRequest>,IndicesRequest,WriteRequest<DeleteRequest>,Writeable,RefCounted,TaskAwareRequest
public class DeleteRequest
extends ReplicatedWriteRequest<DeleteRequest>
implements DocWriteRequest<DeleteRequest>, CompositeIndicesRequest
A request to delete a document from an index based on its type and id.
The operation requires the ReplicationRequest.index() and id(String) to
be set.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.action.DocWriteRequest
DocWriteRequest.OpTypeNested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.RemoteClusterShardRequest, IndicesRequest.Replaceable, IndicesRequest.SingleIndexNoWildcardsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>Nested classes/interfaces inherited from interface org.elasticsearch.action.support.WriteRequest
WriteRequest.RefreshPolicy -
Field Summary
Fields inherited from class org.elasticsearch.action.support.replication.ReplicationRequest
DEFAULT_TIMEOUT, index, shardId, timeout, waitForActiveShardsFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLEFields inherited from interface org.elasticsearch.action.DocWriteRequest
LIST_EXECUTED_PIPELINES, REQUIRE_ALIAS, REQUIRE_DATA_STREAMFields inherited from interface org.elasticsearch.core.RefCounted
ALWAYS_REFERENCED -
Constructor Summary
ConstructorsConstructorDescriptionDeleteRequest(String index) Constructs a new delete request against the specified index.DeleteRequest(String index, String id) Constructs a new delete request against the specified index and id.DeleteRequest(ShardId shardId, StreamInput in) -
Method Summary
Modifier and TypeMethodDescriptionid()The id of the document to delete.Sets the id of the document to delete.longIf set, only perform this delete request if the document was last modification was assigned this primary term.longifSeqNo()If set, only perform this delete request if the document was last modification was assigned this sequence number.booleanShould this request override specifically require the destination to be an alias?booleanShould this request override specifically require the destination to be a data stream?opType()Get the requested document operation type of the requestlongintroute(IndexRouting indexRouting) Pick the appropriate shard id to receive this request.routing()Controls the shard routing of the delete request.Controls the shard routing of the request.setIfPrimaryTerm(long term) only perform this delete request if the document was last modification was assigned the given primary term.setIfSeqNo(long seqNo) only perform this delete request if the document was last modification was assigned the given sequence number.toString()validate()longversion()Get the document version for this requestversion(long version) Sets the version, which will perform the operation only if a matching version exists and no changes happened on the doc since then.Get the document version type for this requestversionType(VersionType versionType) Sets the versioning type.voidwriteThin(StreamOutput out) Thin serialization that does not writeReplicationRequest.shardIdand will only writeReplicationRequest.indexif it is different from the index name inReplicationRequest.shardId.voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class org.elasticsearch.action.support.replication.ReplicatedWriteRequest
getRefreshPolicy, setRefreshPolicyMethods inherited from class org.elasticsearch.action.support.replication.ReplicationRequest
createTask, getDescription, index, index, indices, indicesOptions, onRetry, routedBasedOnClusterVersion, shardId, timeout, timeout, waitForActiveShards, waitForActiveShards, waitForActiveShardsMethods inherited from class org.elasticsearch.action.ActionRequest
getShouldStoreResultMethods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, getRequestId, setParentTask, setRequestIdMethods inherited from class org.elasticsearch.transport.TransportMessage
decRef, hasReferences, incRef, remoteAddress, remoteAddress, tryIncRefMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResourcesMethods inherited from interface org.elasticsearch.action.DocWriteRequest
getConcreteWriteIndex, index, index, indicesOptions, postRoutingProcess, preRoutingProcessMethods inherited from interface org.elasticsearch.action.IndicesRequest
includeDataStreams, indicesMethods inherited from interface org.elasticsearch.core.RefCounted
mustIncRefMethods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
setParentTaskMethods inherited from interface org.elasticsearch.action.support.WriteRequest
setRefreshPolicy
-
Constructor Details
-
DeleteRequest
- Throws:
IOException
-
DeleteRequest
- Throws:
IOException
-
DeleteRequest
public DeleteRequest() -
DeleteRequest
Constructs a new delete request against the specified index. Theid(String)must be set. -
DeleteRequest
Constructs a new delete request against the specified index and id.- Parameters:
index- The index to get the document fromid- The id of the document
-
-
Method Details
-
validate
- Specified by:
validatein interfaceWriteRequest<DeleteRequest>- Overrides:
validatein classReplicationRequest<DeleteRequest>
-
id
The id of the document to delete.- Specified by:
idin interfaceDocWriteRequest<DeleteRequest>- Returns:
- the id
-
id
Sets the id of the document to delete. -
routing
Controls the shard routing of the request. Using this value to hash the shard and not the id.- Specified by:
routingin interfaceDocWriteRequest<DeleteRequest>- Returns:
- the Request
-
routing
Controls the shard routing of the delete request. Using this value to hash the shard and not the id.- Specified by:
routingin interfaceDocWriteRequest<DeleteRequest>- Returns:
- the Routing
-
version
Description copied from interface:DocWriteRequestSets the version, which will perform the operation only if a matching version exists and no changes happened on the doc since then.- Specified by:
versionin interfaceDocWriteRequest<DeleteRequest>
-
version
public long version()Description copied from interface:DocWriteRequestGet the document version for this request- Specified by:
versionin interfaceDocWriteRequest<DeleteRequest>- Returns:
- the document version
-
versionType
Description copied from interface:DocWriteRequestSets the versioning type. Defaults toVersionType.INTERNAL.- Specified by:
versionTypein interfaceDocWriteRequest<DeleteRequest>
-
ifSeqNo
public long ifSeqNo()If set, only perform this delete request if the document was last modification was assigned this sequence number. If the document last modification was assigned a different sequence number aVersionConflictEngineExceptionwill be thrown.- Specified by:
ifSeqNoin interfaceDocWriteRequest<DeleteRequest>
-
ifPrimaryTerm
public long ifPrimaryTerm()If set, only perform this delete request if the document was last modification was assigned this primary term. If the document last modification was assigned a different term aVersionConflictEngineExceptionwill be thrown.- Specified by:
ifPrimaryTermin interfaceDocWriteRequest<DeleteRequest>
-
setIfSeqNo
only perform this delete request if the document was last modification was assigned the given sequence number. Must be used in combination withsetIfPrimaryTerm(long)If the document last modification was assigned a different sequence number aVersionConflictEngineExceptionwill be thrown.- Specified by:
setIfSeqNoin interfaceDocWriteRequest<DeleteRequest>
-
setIfPrimaryTerm
only perform this delete request if the document was last modification was assigned the given primary term. Must be used in combination withsetIfSeqNo(long)If the document last modification was assigned a different primary term aVersionConflictEngineExceptionwill be thrown.- Specified by:
setIfPrimaryTermin interfaceDocWriteRequest<DeleteRequest>
-
versionType
Description copied from interface:DocWriteRequestGet the document version type for this request- Specified by:
versionTypein interfaceDocWriteRequest<DeleteRequest>- Returns:
- the document version type
-
opType
Description copied from interface:DocWriteRequestGet the requested document operation type of the request- Specified by:
opTypein interfaceDocWriteRequest<DeleteRequest>- Returns:
- the operation type
DocWriteRequest.OpType
-
isRequireAlias
public boolean isRequireAlias()Description copied from interface:DocWriteRequestShould this request override specifically require the destination to be an alias?- Specified by:
isRequireAliasin interfaceDocWriteRequest<DeleteRequest>- Returns:
- boolean flag, when true specifically requires an alias
-
isRequireDataStream
public boolean isRequireDataStream()Description copied from interface:DocWriteRequestShould this request override specifically require the destination to be a data stream?- Specified by:
isRequireDataStreamin interfaceDocWriteRequest<DeleteRequest>- Returns:
- boolean flag, when true specifically requires a data stream
-
route
Description copied from interface:DocWriteRequestPick the appropriate shard id to receive this request.- Specified by:
routein interfaceDocWriteRequest<DeleteRequest>
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classReplicatedWriteRequest<DeleteRequest>- Throws:
IOException
-
writeThin
Description copied from class:ReplicationRequestThin serialization that does not writeReplicationRequest.shardIdand will only writeReplicationRequest.indexif it is different from the index name inReplicationRequest.shardId.- Overrides:
writeThinin classReplicatedWriteRequest<DeleteRequest>- Throws:
IOException
-
toString
- Specified by:
toStringin classReplicationRequest<DeleteRequest>
-
ramBytesUsed
public long ramBytesUsed()- Specified by:
ramBytesUsedin interfaceorg.apache.lucene.util.Accountable
-