DocWriteRequest<UpdateRequest>, IndicesRequest, WriteRequest<UpdateRequest>, Streamable, Writeable, ToXContent, ToXContentObject, TaskAwareRequestpublic class UpdateRequest extends InstanceShardOperationRequest<UpdateRequest> implements DocWriteRequest<UpdateRequest>, WriteRequest<UpdateRequest>, ToXContentObject
DocWriteRequest.OpTypeIndicesRequest.ReplaceableToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsTransportRequest.EmptyWriteable.Reader<V>, Writeable.Writer<V>WriteRequest.RefreshPolicyDEFAULT_TIMEOUT, index, shardId, timeoutEMPTY_PARAMS| Constructor | Description |
|---|---|
UpdateRequest() |
|
UpdateRequest(java.lang.String index,
java.lang.String type,
java.lang.String id) |
| Modifier and Type | Method | Description |
|---|---|---|
UpdateRequest |
addScriptParam(java.lang.String name,
java.lang.Object value) |
Deprecated.
Use
script(Script) instead |
boolean |
detectNoop() |
Should this update attempt to detect if it is a noop? Defaults to true.
|
UpdateRequest |
detectNoop(boolean detectNoop) |
Should this update attempt to detect if it is a noop? Defaults to true.
|
IndexRequest |
doc() |
|
UpdateRequest |
doc(byte[] source,
int offset,
int length,
XContentType xContentType) |
Sets the doc to use for updates when a script is not specified.
|
UpdateRequest |
doc(byte[] source,
XContentType xContentType) |
Sets the doc to use for updates when a script is not specified.
|
UpdateRequest |
doc(java.lang.Object... source) |
Sets the doc to use for updates when a script is not specified, the doc provided
is a field and value pairs.
|
UpdateRequest |
doc(java.lang.String source,
XContentType xContentType) |
Sets the doc to use for updates when a script is not specified.
|
UpdateRequest |
doc(java.util.Map source) |
Sets the doc to use for updates when a script is not specified.
|
UpdateRequest |
doc(java.util.Map source,
XContentType contentType) |
Sets the doc to use for updates when a script is not specified.
|
UpdateRequest |
doc(IndexRequest doc) |
Sets the doc to use for updates when a script is not specified.
|
UpdateRequest |
doc(XContentBuilder source) |
Sets the doc to use for updates when a script is not specified.
|
UpdateRequest |
doc(XContentType xContentType,
java.lang.Object... source) |
Sets the doc to use for updates when a script is not specified, the doc provided
is a field and value pairs.
|
boolean |
docAsUpsert() |
|
UpdateRequest |
docAsUpsert(boolean shouldUpsertDoc) |
|
FetchSourceContext |
fetchSource() |
Gets the
FetchSourceContext which defines how the _source should
be fetched. |
UpdateRequest |
fetchSource(boolean fetchSource) |
Indicates whether the response should contain the updated _source.
|
UpdateRequest |
fetchSource(java.lang.String[] includes,
java.lang.String[] excludes) |
Indicate that _source should be returned, with an
"include" and/or "exclude" set which can include simple wildcard
elements.
|
UpdateRequest |
fetchSource(java.lang.String include,
java.lang.String exclude) |
Indicate that _source should be returned with every hit, with an
"include" and/or "exclude" set which can include simple wildcard
elements.
|
UpdateRequest |
fetchSource(FetchSourceContext context) |
Explicitly set the fetch source context for this request
|
java.lang.String[] |
fields() |
Deprecated.
Use
fetchSource() instead |
UpdateRequest |
fields(java.lang.String... fields) |
Deprecated.
Use
fetchSource(String[], String[]) instead |
UpdateRequest |
fromXContent(XContentParser parser) |
|
WriteRequest.RefreshPolicy |
getRefreshPolicy() |
Should this request trigger a refresh (WriteRequest.RefreshPolicy.IMMEDIATE), wait for a refresh (
WriteRequest.RefreshPolicy.WAIT_UNTIL), or proceed ignore refreshes entirely (WriteRequest.RefreshPolicy.NONE, the default).
|
ShardId |
getShardId() |
|
java.lang.String |
id() |
The id of the indexed document.
|
UpdateRequest |
id(java.lang.String id) |
Sets the id of the indexed document.
|
DocWriteRequest.OpType |
opType() |
Get the requested document operation type of the request
|
java.lang.String |
parent() |
Get the parent for this request
|
UpdateRequest |
parent(java.lang.String parent) |
The parent id is used for the upsert request.
|
void |
readFrom(StreamInput in) |
Set this object's fields from a StreamInput.
|
int |
retryOnConflict() |
|
UpdateRequest |
retryOnConflict(int retryOnConflict) |
Sets the number of retries of a version conflict occurs because the document was updated between
getting it and updating it.
|
java.lang.String |
routing() |
Controls the shard routing of the request.
|
UpdateRequest |
routing(java.lang.String routing) |
Controls the shard routing of the request.
|
Script |
script() |
|
UpdateRequest |
script(java.lang.String script) |
Deprecated.
Use
script(Script) instead |
UpdateRequest |
script(java.lang.String script,
java.lang.String scriptLang,
ScriptType scriptType,
java.util.Map<java.lang.String,java.lang.Object> scriptParams) |
Deprecated.
Use
script(Script) instead |
UpdateRequest |
script(java.lang.String script,
ScriptType scriptType) |
Deprecated.
Use
script(Script) instead |
UpdateRequest |
script(java.lang.String script,
ScriptType scriptType,
java.util.Map<java.lang.String,java.lang.Object> scriptParams) |
Deprecated.
Use
script(Script) instead |
UpdateRequest |
script(Script script) |
The script to execute.
|
boolean |
scriptedUpsert() |
|
UpdateRequest |
scriptedUpsert(boolean scriptedUpsert) |
|
java.lang.String |
scriptLang() |
Deprecated.
Use
script() instead |
UpdateRequest |
scriptLang(java.lang.String scriptLang) |
Deprecated.
Use
script(Script) instead |
java.util.Map<java.lang.String,java.lang.Object> |
scriptParams() |
Deprecated.
Use
script() instead |
UpdateRequest |
scriptParams(java.util.Map<java.lang.String,java.lang.Object> scriptParams) |
Deprecated.
Use
script(Script) instead |
java.lang.String |
scriptString() |
Deprecated.
Use
script() instead |
ScriptType |
scriptType() |
Deprecated.
Use
script() instead |
UpdateRequest |
setRefreshPolicy(WriteRequest.RefreshPolicy refreshPolicy) |
Should this request trigger a refresh (WriteRequest.RefreshPolicy.IMMEDIATE), wait for a refresh (
WriteRequest.RefreshPolicy.WAIT_UNTIL), or proceed ignore refreshes entirely (WriteRequest.RefreshPolicy.NONE, the default).
|
java.lang.String |
toString() |
|
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
|
java.lang.String |
type() |
The type of the indexed document.
|
UpdateRequest |
type(java.lang.String type) |
Sets the type of the indexed document.
|
UpdateRequest |
upsert(byte[] source,
int offset,
int length,
XContentType xContentType) |
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequest |
upsert(byte[] source,
XContentType xContentType) |
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequest |
upsert(java.lang.Object... source) |
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequest |
upsert(java.lang.String source,
XContentType xContentType) |
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequest |
upsert(java.util.Map source) |
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequest |
upsert(java.util.Map source,
XContentType contentType) |
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequest |
upsert(IndexRequest upsertRequest) |
Sets the index request to be used if the document does not exists.
|
UpdateRequest |
upsert(XContentBuilder source) |
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequest |
upsert(XContentType xContentType,
java.lang.Object... source) |
Sets the doc source of the update request to be used when the document does not exists.
|
IndexRequest |
upsertRequest() |
|
ActionRequestValidationException |
validate() |
|
long |
version() |
Get the document version for this request
|
UpdateRequest |
version(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.
|
VersionType |
versionType() |
Get the document version type for this request
|
UpdateRequest |
versionType(VersionType versionType) |
Sets the versioning type.
|
ActiveShardCount |
waitForActiveShards() |
|
UpdateRequest |
waitForActiveShards(int waitForActiveShards) |
A shortcut for
waitForActiveShards(ActiveShardCount) where the numerical
shard count is passed in, instead of having to first call ActiveShardCount.from(int)
to get the ActiveShardCount. |
UpdateRequest |
waitForActiveShards(ActiveShardCount waitForActiveShards) |
Sets the number of shard copies that must be active before proceeding with the write.
|
void |
writeTo(StreamOutput out) |
Write this object's fields to a StreamOutput.
|
getShouldStoreResultindex, indicesOptions, readDocumentRequest, writeDocumentRequestindicesconcreteIndex, index, index, indices, indicesOptions, timeout, timeout, timeoutclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitnewWriteableReadercreateTask, getDescription, setParentTaskisFragmentremoteAddress, remoteAddressgetParentTask, setParentTasksetRefreshPolicypublic UpdateRequest()
public UpdateRequest(java.lang.String index,
java.lang.String type,
java.lang.String id)
public ActionRequestValidationException validate()
validate in interface WriteRequest<UpdateRequest>validate in class InstanceShardOperationRequest<UpdateRequest>public java.lang.String type()
type in interface DocWriteRequest<UpdateRequest>public UpdateRequest type(java.lang.String type)
public java.lang.String id()
id in interface DocWriteRequest<UpdateRequest>public UpdateRequest id(java.lang.String id)
public UpdateRequest routing(java.lang.String routing)
routing in interface DocWriteRequest<UpdateRequest>public java.lang.String routing()
routing in interface DocWriteRequest<UpdateRequest>public UpdateRequest parent(java.lang.String parent)
public java.lang.String parent()
DocWriteRequestparent in interface DocWriteRequest<UpdateRequest>public ShardId getShardId()
public Script script()
public UpdateRequest script(Script script)
@Deprecated public java.lang.String scriptString()
script() instead@Deprecated public ScriptType scriptType()
script() instead@Deprecated public java.util.Map<java.lang.String,java.lang.Object> scriptParams()
script() instead@Deprecated public UpdateRequest script(java.lang.String script, ScriptType scriptType)
script(Script) instead@Deprecated public UpdateRequest script(java.lang.String script)
script(Script) instead@Deprecated public UpdateRequest scriptLang(java.lang.String scriptLang)
script(Script) instead@Deprecated public java.lang.String scriptLang()
script() instead@Deprecated public UpdateRequest addScriptParam(java.lang.String name, java.lang.Object value)
script(Script) instead@Deprecated public UpdateRequest scriptParams(java.util.Map<java.lang.String,java.lang.Object> scriptParams)
script(Script) instead@Deprecated public UpdateRequest script(java.lang.String script, ScriptType scriptType, @Nullable java.util.Map<java.lang.String,java.lang.Object> scriptParams)
script(Script) instead@Deprecated public UpdateRequest script(java.lang.String script, @Nullable java.lang.String scriptLang, ScriptType scriptType, @Nullable java.util.Map<java.lang.String,java.lang.Object> scriptParams)
script(Script) insteadscript - The script to executescriptLang - The script languagescriptType - The script typescriptParams - The script parameters@Deprecated public UpdateRequest fields(java.lang.String... fields)
fetchSource(String[], String[]) insteadpublic UpdateRequest fetchSource(@Nullable java.lang.String include, @Nullable java.lang.String exclude)
include - An optional include (optionally wildcarded) pattern to filter
the returned _sourceexclude - An optional exclude (optionally wildcarded) pattern to filter
the returned _sourcepublic UpdateRequest fetchSource(@Nullable java.lang.String[] includes, @Nullable java.lang.String[] excludes)
includes - An optional list of include (optionally wildcarded) pattern to
filter the returned _sourceexcludes - An optional list of exclude (optionally wildcarded) pattern to
filter the returned _sourcepublic UpdateRequest fetchSource(boolean fetchSource)
public UpdateRequest fetchSource(FetchSourceContext context)
@Deprecated public java.lang.String[] fields()
fetchSource() insteadpublic FetchSourceContext fetchSource()
FetchSourceContext which defines how the _source should
be fetched.public UpdateRequest retryOnConflict(int retryOnConflict)
public int retryOnConflict()
public UpdateRequest version(long version)
DocWriteRequestversion in interface DocWriteRequest<UpdateRequest>public long version()
DocWriteRequestversion in interface DocWriteRequest<UpdateRequest>public UpdateRequest versionType(VersionType versionType)
DocWriteRequestVersionType.INTERNAL.versionType in interface DocWriteRequest<UpdateRequest>public VersionType versionType()
DocWriteRequestversionType in interface DocWriteRequest<UpdateRequest>public DocWriteRequest.OpType opType()
DocWriteRequestopType in interface DocWriteRequest<UpdateRequest>DocWriteRequest.OpTypepublic UpdateRequest setRefreshPolicy(WriteRequest.RefreshPolicy refreshPolicy)
WriteRequestsetRefreshPolicy in interface WriteRequest<UpdateRequest>public WriteRequest.RefreshPolicy getRefreshPolicy()
WriteRequestgetRefreshPolicy in interface WriteRequest<UpdateRequest>public ActiveShardCount waitForActiveShards()
public UpdateRequest waitForActiveShards(ActiveShardCount waitForActiveShards)
ReplicationRequest.waitForActiveShards(ActiveShardCount) for details.public UpdateRequest waitForActiveShards(int waitForActiveShards)
waitForActiveShards(ActiveShardCount) where the numerical
shard count is passed in, instead of having to first call ActiveShardCount.from(int)
to get the ActiveShardCount.public UpdateRequest doc(IndexRequest doc)
public UpdateRequest doc(XContentBuilder source)
public UpdateRequest doc(java.util.Map source)
public UpdateRequest doc(java.util.Map source, XContentType contentType)
public UpdateRequest doc(java.lang.String source, XContentType xContentType)
public UpdateRequest doc(byte[] source, XContentType xContentType)
public UpdateRequest doc(byte[] source, int offset, int length, XContentType xContentType)
public UpdateRequest doc(java.lang.Object... source)
public UpdateRequest doc(XContentType xContentType, java.lang.Object... source)
public IndexRequest doc()
public UpdateRequest upsert(IndexRequest upsertRequest)
DocumentMissingException
is thrown.public UpdateRequest upsert(XContentBuilder source)
public UpdateRequest upsert(java.util.Map source)
public UpdateRequest upsert(java.util.Map source, XContentType contentType)
public UpdateRequest upsert(java.lang.String source, XContentType xContentType)
public UpdateRequest upsert(byte[] source, XContentType xContentType)
public UpdateRequest upsert(byte[] source, int offset, int length, XContentType xContentType)
public UpdateRequest upsert(java.lang.Object... source)
public UpdateRequest upsert(XContentType xContentType, java.lang.Object... source)
public IndexRequest upsertRequest()
public UpdateRequest detectNoop(boolean detectNoop)
public boolean detectNoop()
public UpdateRequest fromXContent(XContentParser parser) throws java.io.IOException
java.io.IOExceptionpublic boolean docAsUpsert()
public UpdateRequest docAsUpsert(boolean shouldUpsertDoc)
public boolean scriptedUpsert()
public UpdateRequest scriptedUpsert(boolean scriptedUpsert)
public void readFrom(StreamInput in) throws java.io.IOException
StreamablereadFrom in interface StreamablereadFrom in class InstanceShardOperationRequest<UpdateRequest>java.io.IOExceptionpublic void writeTo(StreamOutput out) throws java.io.IOException
StreamablewriteTo in interface StreamablewriteTo in interface WriteablewriteTo in class InstanceShardOperationRequest<UpdateRequest>java.io.IOExceptionpublic XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
toXContent in interface ToXContentjava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Object