public class UpdateRequest extends InstanceShardOperationRequest<UpdateRequest> implements DocumentRequest<UpdateRequest>
TransportRequest.Empty
IndicesRequest.Replaceable
DEFAULT_TIMEOUT, index, shardId, timeout
headers
Constructor and Description |
---|
UpdateRequest() |
UpdateRequest(String index,
String type,
String id) |
Modifier and Type | Method and Description |
---|---|
UpdateRequest |
addScriptParam(String name,
Object value)
Deprecated.
Use
script(Script) instead |
WriteConsistencyLevel |
consistencyLevel() |
UpdateRequest |
consistencyLevel(WriteConsistencyLevel consistencyLevel)
Sets the consistency level of write.
|
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(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() |
UpdateRequest |
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.
|
String |
parent() |
UpdateRequest |
parent(String parent)
The parent id is used for the upsert request and also implicitely sets the routing if not already set.
|
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.
|
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.
|
Script |
script() |
UpdateRequest |
script(Script script)
The script to execute.
|
UpdateRequest |
script(String script)
Deprecated.
Use
script(Script) instead |
UpdateRequest |
script(String script,
ScriptService.ScriptType scriptType)
Deprecated.
Use
script(Script) instead |
UpdateRequest |
script(String script,
ScriptService.ScriptType scriptType,
Map<String,Object> scriptParams)
Deprecated.
Use
script(Script) instead |
UpdateRequest |
script(String script,
String scriptLang,
ScriptService.ScriptType scriptType,
Map<String,Object> scriptParams)
Deprecated.
Use
script(Script) instead |
boolean |
scriptedUpsert() |
UpdateRequest |
scriptedUpsert(boolean scriptedUpsert) |
String |
scriptLang()
Deprecated.
Use
script() instead |
UpdateRequest |
scriptLang(String scriptLang)
Deprecated.
Use
script(Script) instead |
Map<String,Object> |
scriptParams()
Deprecated.
Use
script() instead |
UpdateRequest |
scriptParams(Map<String,Object> scriptParams)
Deprecated.
Use
script(Script) instead |
String |
scriptString()
Deprecated.
Use
script() instead |
ScriptService.ScriptType |
scriptType()
Deprecated.
Use
script() instead |
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) |
concreteIndex, index, index, indices, indicesOptions, timeout, timeout, timeout
createTask, getDescription
remoteAddress, remoteAddress
contextSize, copyContextAndHeadersFrom, copyContextFrom, copyHeadersFrom, getContext, getFromContext, getFromContext, getHeader, getHeaders, hasHeader, hasInContext, isContextEmpty, putAllInContext, putHeader, putInContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
index, indicesOptions
indices
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 String routing()
routing
in interface DocumentRequest<UpdateRequest>
public UpdateRequest parent(String parent)
public String parent()
public Script script()
public UpdateRequest script(Script script)
@Deprecated public String scriptString()
script()
instead@Deprecated public ScriptService.ScriptType scriptType()
script()
instead@Deprecated public Map<String,Object> scriptParams()
script()
instead@Deprecated public UpdateRequest script(String script, ScriptService.ScriptType scriptType)
script(Script)
instead@Deprecated public UpdateRequest script(String script)
script(Script)
instead@Deprecated public UpdateRequest scriptLang(String scriptLang)
script(Script)
instead@Deprecated public String scriptLang()
script()
instead@Deprecated public UpdateRequest addScriptParam(String name, Object value)
script(Script)
instead@Deprecated public UpdateRequest scriptParams(Map<String,Object> scriptParams)
script(Script)
instead@Deprecated public UpdateRequest script(String script, ScriptService.ScriptType scriptType, @Nullable Map<String,Object> scriptParams)
script(Script)
instead@Deprecated public UpdateRequest script(String script, @Nullable String scriptLang, ScriptService.ScriptType scriptType, @Nullable Map<String,Object> scriptParams)
script(Script)
insteadscript
- 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 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 UpdateRequest docAsUpsert(boolean shouldUpsertDoc)
public boolean scriptedUpsert()
public UpdateRequest 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–2016. All rights reserved.