Package org.elasticsearch.action
Interface DocWriteRequest<T>
- All Superinterfaces:
org.apache.lucene.util.Accountable
,IndicesRequest
- All Known Implementing Classes:
DeleteRequest
,IndexRequest
,UpdateRequest
Generic interface to group ActionRequest, which perform writes to a single document
Action requests implementing this can be part of
BulkRequest
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Requested operation type to perform on the documentNested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.Replaceable
-
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
Method Summary
Modifier and TypeMethodDescriptiondefaultTypeIfNull(String defaultType)
Set the default type supplied to a bulk request if this individual request's type is null or emptyid()
Get the id of the document for this requestlong
If set, only perform this request if the document was last modification was assigned this primary term.long
ifSeqNo()
If set, only perform this request if the document was last modification was assigned this sequence number.index()
Get the index that this request operates onSet the index for this requestGet the options for this requestboolean
Should this request override specifically require the destination to be an alias?opType()
Get the requested document operation type of the requeststatic DocWriteRequest<?>
readDocumentRequest(ShardId shardId, StreamInput in)
Read a document write (index/delete/update) requestrouting()
Get the routing for this requestSet the routing for this requestsetIfPrimaryTerm(long term)
only performs this request if the document was last modification was assigned the given primary term.setIfSeqNo(long seqNo)
only perform this request if the document was last modification was assigned the given sequence number.type()
Get the type that this request operates onSet the type for this requestvalidateSeqNoBasedCASParams(DocWriteRequest request, ActionRequestValidationException validationException)
long
version()
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.static void
writeDocumentRequest(StreamOutput out, DocWriteRequest<?> request)
write a document write (index/delete/update) requeststatic void
writeDocumentRequestThin(StreamOutput out, DocWriteRequest<?> request)
write a document write (index/delete/update) request without shard idMethods inherited from interface org.apache.lucene.util.Accountable
getChildResources, ramBytesUsed
Methods inherited from interface org.elasticsearch.action.IndicesRequest
allowsRemoteIndices, includeDataStreams, indices
-
Field Details
-
REQUIRE_ALIAS
- See Also:
- Constant Field Values
-
-
Method Details
-
index
Set the index for this request- Returns:
- the Request
-
index
String index()Get the index that this request operates on- Returns:
- the index
-
type
Set the type for this request- Returns:
- the Request
-
type
String type()Get the type that this request operates on- Returns:
- the type
-
defaultTypeIfNull
Set the default type supplied to a bulk request if this individual request's type is null or empty- Returns:
- the Request
-
id
String id()Get the id of the document for this request- Returns:
- the id
-
indicesOptions
IndicesOptions indicesOptions()Get the options for this request- Specified by:
indicesOptions
in interfaceIndicesRequest
- Returns:
- the indices options
-
routing
Set the routing for this request- Returns:
- the Request
-
routing
String routing()Get the routing for this request- Returns:
- the Routing
-
version
long version()Get the document version for this request- Returns:
- the document version
-
version
Sets the version, which will perform the operation only if a matching version exists and no changes happened on the doc since then. -
versionType
VersionType versionType()Get the document version type for this request- Returns:
- the document version type
-
versionType
Sets the versioning type. Defaults toVersionType.INTERNAL
. -
setIfSeqNo
only perform this 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 aVersionConflictEngineException
will be thrown. -
setIfPrimaryTerm
only performs this 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 term aVersionConflictEngineException
will be thrown. -
ifSeqNo
long ifSeqNo()If set, only perform this request if the document was last modification was assigned this sequence number. If the document last modification was assigned a different sequence number aVersionConflictEngineException
will be thrown. -
ifPrimaryTerm
long ifPrimaryTerm()If set, only perform this request if the document was last modification was assigned this primary term. If the document last modification was assigned a different term aVersionConflictEngineException
will be thrown. -
opType
DocWriteRequest.OpType opType()Get the requested document operation type of the request- Returns:
- the operation type
DocWriteRequest.OpType
-
isRequireAlias
boolean isRequireAlias()Should this request override specifically require the destination to be an alias?- Returns:
- boolean flag, when true specifically requires an alias
-
readDocumentRequest
static DocWriteRequest<?> readDocumentRequest(@Nullable ShardId shardId, StreamInput in) throws IOExceptionRead a document write (index/delete/update) request- Parameters:
shardId
- shard id of the request.null
when reading as part of aBulkRequest
that does not have a unique shard id or when reading from a stream of version older thanBulkShardRequest.COMPACT_SHARD_ID_VERSION
- Throws:
IOException
-
writeDocumentRequest
write a document write (index/delete/update) request- Throws:
IOException
-
writeDocumentRequestThin
static void writeDocumentRequestThin(StreamOutput out, DocWriteRequest<?> request) throws IOExceptionwrite a document write (index/delete/update) request without shard id- Throws:
IOException
-
validateSeqNoBasedCASParams
static ActionRequestValidationException validateSeqNoBasedCASParams(DocWriteRequest request, ActionRequestValidationException validationException)
-