public class UpdateRequest extends InstanceShardOperationRequest<UpdateRequest> implements DocumentRequest<UpdateRequest>
TransportRequest.Empty
IndicesRequest.Replaceable
DEFAULT_TIMEOUT, index, shardId, timeout
Constructor and Description |
---|
UpdateRequest() |
UpdateRequest(String index,
String type,
String id) |
Modifier and Type | Method and Description |
---|---|
UpdateRequest |
addScriptParam(String name,
Object value)
Add a script parameter.
|
WriteConsistencyLevel |
consistencyLevel() |
UpdateRequest |
consistencyLevel(WriteConsistencyLevel consistencyLevel)
Sets the consistency level of write.
|
boolean |
detectNoop() |
UpdateRequest |
detectNoop(boolean detectNoop)
Should this update attempt to detect if it is a noop?
|
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(Map source)
Sets the doc to use for updates when a script is not specified.
|
UpdateRequest |
doc(Map source,
XContentType contentType)
Sets the doc to use for updates when a script is not specified.
|
UpdateRequest |
doc(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(String source)
Sets the doc to use for updates when a script is not specified.
|
UpdateRequest |
doc(String field,
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() |
void |
docAsUpsert(boolean shouldUpsertDoc) |
String[] |
fields()
Get the fields to be returned.
|
UpdateRequest |
fields(String... fields)
Explicitly specify the fields that will be returned.
|
String |
id()
The id of the indexed document.
|
UpdateRequest |
id(String id)
Sets the id of the indexed document.
|
UpdateRequest |
parent(String parent)
Sets the parent id of this document.
|
void |
readFrom(StreamInput in) |
boolean |
refresh() |
UpdateRequest |
refresh(boolean refresh)
Should a refresh be executed post this update operation causing the operation to
be searchable.
|
ReplicationType |
replicationType()
The replication type.
|
UpdateRequest |
replicationType(ReplicationType replicationType)
Sets the replication type.
|
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.
|
String |
routing()
Controls the shard routing of the request.
|
UpdateRequest |
routing(String routing)
Controls the shard routing of the request.
|
String |
script() |
UpdateRequest |
script(String script)
The script to execute.
|
UpdateRequest |
script(String script,
ScriptService.ScriptType scriptType)
The script to execute.
|
UpdateRequest |
script(String script,
ScriptService.ScriptType scriptType,
Map<String,Object> scriptParams)
The script to execute.
|
UpdateRequest |
script(String script,
String scriptLang,
ScriptService.ScriptType scriptType,
Map<String,Object> scriptParams)
The script to execute.
|
boolean |
scriptedUpsert() |
void |
scriptedUpsert(boolean scriptedUpsert) |
String |
scriptLang() |
UpdateRequest |
scriptLang(String scriptLang)
The language of the script to execute.
|
Map<String,Object> |
scriptParams() |
UpdateRequest |
scriptParams(Map<String,Object> scriptParams)
Sets the script parameters to use with the script.
|
ScriptService.ScriptType |
scriptType() |
UpdateRequest |
source(byte[] source) |
UpdateRequest |
source(byte[] source,
int offset,
int length) |
UpdateRequest |
source(BytesReference source) |
UpdateRequest |
source(XContentBuilder source) |
String |
type()
The type of the indexed document.
|
UpdateRequest |
type(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(Map source)
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequest |
upsert(Map source,
XContentType contentType)
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequest |
upsert(Object... source)
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequest |
upsert(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.
|
void |
writeTo(StreamOutput out) |
beforeLocalFork, index, index, indices, indicesOptions, timeout, timeout, timeout
listenerThreaded, listenerThreaded
getHeader, getHeaders, hasHeader, putHeader, remoteAddress, remoteAddress
contextSize, copyContextFrom, getContext, getFromContext, getFromContext, hasInContext, isContextEmpty, putAllInContext, putInContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
index, indicesOptions
public ActionRequestValidationException validate()
validate
in class InstanceShardOperationRequest<UpdateRequest>
public String type()
type
in interface DocumentRequest<UpdateRequest>
public UpdateRequest type(String type)
public String id()
id
in interface DocumentRequest<UpdateRequest>
public UpdateRequest id(String id)
public UpdateRequest routing(String routing)
routing
in interface DocumentRequest<UpdateRequest>
public UpdateRequest parent(String parent)
public String routing()
routing
in interface DocumentRequest<UpdateRequest>
public String script()
public ScriptService.ScriptType scriptType()
public UpdateRequest script(String script, ScriptService.ScriptType scriptType)
public UpdateRequest script(String script)
public UpdateRequest scriptLang(String scriptLang)
public String scriptLang()
public UpdateRequest addScriptParam(String name, Object value)
public UpdateRequest scriptParams(Map<String,Object> scriptParams)
public UpdateRequest script(String script, ScriptService.ScriptType scriptType, @Nullable Map<String,Object> scriptParams)
public UpdateRequest script(String script, @Nullable String scriptLang, ScriptService.ScriptType scriptType, @Nullable Map<String,Object> scriptParams)
script
- The script to executescriptLang
- The script languagescriptType
- The script typescriptParams
- The script parameterspublic UpdateRequest fields(String... fields)
public String[] fields()
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 refresh(boolean refresh)
public boolean refresh()
public ReplicationType replicationType()
public UpdateRequest replicationType(ReplicationType replicationType)
public WriteConsistencyLevel consistencyLevel()
public UpdateRequest consistencyLevel(WriteConsistencyLevel consistencyLevel)
WriteConsistencyLevel.DEFAULT
public UpdateRequest doc(IndexRequest doc)
public UpdateRequest doc(XContentBuilder source)
public UpdateRequest doc(Map source)
public UpdateRequest doc(Map source, XContentType contentType)
public UpdateRequest doc(String source)
public UpdateRequest doc(byte[] source)
public UpdateRequest doc(byte[] source, int offset, int length)
public UpdateRequest doc(Object... source)
public UpdateRequest doc(String field, Object value)
public IndexRequest doc()
public UpdateRequest upsert(IndexRequest upsertRequest)
DocumentMissingException
is thrown.public UpdateRequest upsert(XContentBuilder source)
public UpdateRequest upsert(Map source)
public UpdateRequest upsert(Map source, XContentType contentType)
public UpdateRequest upsert(String source)
public UpdateRequest upsert(byte[] source)
public UpdateRequest upsert(byte[] source, int offset, int length)
public UpdateRequest upsert(Object... source)
public IndexRequest upsertRequest()
public UpdateRequest source(XContentBuilder source) throws Exception
Exception
public UpdateRequest source(byte[] source) throws Exception
Exception
public UpdateRequest source(byte[] source, int offset, int length) throws Exception
Exception
public UpdateRequest detectNoop(boolean detectNoop)
public boolean detectNoop()
public UpdateRequest source(BytesReference source) throws Exception
Exception
public boolean docAsUpsert()
public void docAsUpsert(boolean shouldUpsertDoc)
public boolean scriptedUpsert()
public void scriptedUpsert(boolean scriptedUpsert)
public void readFrom(StreamInput in) throws IOException
readFrom
in interface Streamable
readFrom
in class InstanceShardOperationRequest<UpdateRequest>
IOException
public void writeTo(StreamOutput out) throws IOException
writeTo
in interface Streamable
writeTo
in class InstanceShardOperationRequest<UpdateRequest>
IOException
Copyright © 2009–2015. All rights reserved.