public class UpdateRequest extends InstanceShardOperationRequest<UpdateRequest> implements DocumentRequest<UpdateRequest>, WriteRequest<UpdateRequest>
TransportRequest.Empty
IndicesRequest.Replaceable
WriteRequest.RefreshPolicy
DEFAULT_TIMEOUT, index, shardId, timeout
Constructor and Description |
---|
UpdateRequest() |
UpdateRequest(java.lang.String index,
java.lang.String type,
java.lang.String id) |
Modifier and Type | Method and 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)
Sets the doc to use for updates when a script is not specified.
|
UpdateRequest |
doc(byte[] source,
int offset,
int length)
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(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(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)
Sets the doc to use for updates when a script is not specified.
|
UpdateRequest |
doc(java.lang.String field,
java.lang.Object value)
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.
|
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(FetchSourceContext context)
Explicitely set the fetch source context for this request
|
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.
|
java.lang.String[] |
fields()
Deprecated.
Use
fetchSource() instead |
UpdateRequest |
fields(java.lang.String... fields)
Deprecated.
Use
fetchSource(String[], String[]) instead |
UpdateRequest |
fromXContent(byte[] source) |
UpdateRequest |
fromXContent(byte[] source,
int offset,
int length) |
UpdateRequest |
fromXContent(BytesReference source) |
UpdateRequest |
fromXContent(XContentBuilder source) |
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.
|
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(Script script)
The script to execute.
|
UpdateRequest |
script(java.lang.String script)
Deprecated.
Use
script(Script) instead |
UpdateRequest |
script(java.lang.String script,
ScriptService.ScriptType scriptType)
Deprecated.
Use
script(Script) instead |
UpdateRequest |
script(java.lang.String script,
ScriptService.ScriptType scriptType,
java.util.Map<java.lang.String,java.lang.Object> scriptParams)
Deprecated.
Use
script(Script) instead |
UpdateRequest |
script(java.lang.String script,
java.lang.String scriptLang,
ScriptService.ScriptType scriptType,
java.util.Map<java.lang.String,java.lang.Object> scriptParams)
Deprecated.
Use
script(Script) instead |
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 |
ScriptService.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 |
type()
The type of the indexed document.
|
UpdateRequest |
type(java.lang.String type)
Sets the type of the indexed document.
|
UpdateRequest |
upsert(byte[] source)
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequest |
upsert(byte[] source,
int offset,
int length)
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(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(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)
Sets the doc source of the update request to be used when 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.
|
IndexRequest |
upsertRequest() |
ActionRequestValidationException |
validate() |
long |
version() |
UpdateRequest |
version(long version)
Sets the version, which will cause the index operation to only be performed if a matching
version exists and no changes happened on the doc since then.
|
VersionType |
versionType() |
UpdateRequest |
versionType(VersionType versionType)
Sets the versioning type.
|
ActiveShardCount |
waitForActiveShards() |
UpdateRequest |
waitForActiveShards(ActiveShardCount waitForActiveShards)
Sets the number of shard copies that must be active before proceeding with the write.
|
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. |
void |
writeTo(StreamOutput out)
Write this object's fields to a StreamOutput.
|
concreteIndex, index, index, indices, indicesOptions, timeout, timeout, timeout
getShouldStoreResult
createTask, getDescription, getParentTask, setParentTask, setParentTask
remoteAddress, remoteAddress
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
index, indicesOptions
indices
setRefreshPolicy
public 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 DocumentRequest<UpdateRequest>
public UpdateRequest type(java.lang.String type)
public java.lang.String id()
id
in interface DocumentRequest<UpdateRequest>
public UpdateRequest id(java.lang.String id)
public UpdateRequest routing(java.lang.String routing)
routing
in interface DocumentRequest<UpdateRequest>
public java.lang.String routing()
routing
in interface DocumentRequest<UpdateRequest>
public UpdateRequest parent(java.lang.String parent)
public java.lang.String parent()
DocumentRequest
parent
in interface DocumentRequest<UpdateRequest>
public ShardId getShardId()
public Script script()
public UpdateRequest script(Script script)
@Deprecated public java.lang.String scriptString()
script()
instead@Deprecated public ScriptService.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, ScriptService.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, ScriptService.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, ScriptService.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)
public long version()
public UpdateRequest versionType(VersionType versionType)
VersionType.INTERNAL
.public VersionType versionType()
public UpdateRequest setRefreshPolicy(WriteRequest.RefreshPolicy refreshPolicy)
WriteRequest
setRefreshPolicy
in interface WriteRequest<UpdateRequest>
public WriteRequest.RefreshPolicy getRefreshPolicy()
WriteRequest
getRefreshPolicy
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)
public UpdateRequest doc(byte[] source)
public UpdateRequest doc(byte[] source, int offset, int length)
public UpdateRequest doc(java.lang.Object... source)
public UpdateRequest doc(java.lang.String field, java.lang.Object value)
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)
public UpdateRequest upsert(byte[] source)
public UpdateRequest upsert(byte[] source, int offset, int length)
public UpdateRequest upsert(java.lang.Object... source)
public IndexRequest upsertRequest()
public UpdateRequest fromXContent(XContentBuilder source) throws java.lang.Exception
java.lang.Exception
public UpdateRequest fromXContent(byte[] source) throws java.lang.Exception
java.lang.Exception
public UpdateRequest fromXContent(byte[] source, int offset, int length) throws java.lang.Exception
java.lang.Exception
public UpdateRequest detectNoop(boolean detectNoop)
public boolean detectNoop()
public UpdateRequest fromXContent(BytesReference source) throws java.io.IOException
java.io.IOException
public boolean docAsUpsert()
public UpdateRequest docAsUpsert(boolean shouldUpsertDoc)
public boolean scriptedUpsert()
public UpdateRequest scriptedUpsert(boolean scriptedUpsert)
public void readFrom(StreamInput in) throws java.io.IOException
Streamable
readFrom
in interface Streamable
readFrom
in class InstanceShardOperationRequest<UpdateRequest>
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Streamable
writeTo
in interface Streamable
writeTo
in class InstanceShardOperationRequest<UpdateRequest>
java.io.IOException