public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder<UpdateRequest,UpdateResponse,UpdateRequestBuilder>
action, client, request
Constructor and Description |
---|
UpdateRequestBuilder(ElasticsearchClient client,
UpdateAction action) |
UpdateRequestBuilder(ElasticsearchClient client,
UpdateAction action,
String index,
String type,
String id) |
Modifier and Type | Method and Description |
---|---|
UpdateRequestBuilder |
setConsistencyLevel(WriteConsistencyLevel consistencyLevel)
Sets the consistency level of write.
|
UpdateRequestBuilder |
setDetectNoop(boolean detectNoop)
Sets whether to perform extra effort to detect noop updates via docAsUpsert.
|
UpdateRequestBuilder |
setDoc(byte[] source)
Sets the doc to use for updates when a script is not specified.
|
UpdateRequestBuilder |
setDoc(byte[] source,
int offset,
int length)
Sets the doc to use for updates when a script is not specified.
|
UpdateRequestBuilder |
setDoc(IndexRequest indexRequest)
Sets the doc to use for updates when a script is not specified.
|
UpdateRequestBuilder |
setDoc(Map source)
Sets the doc to use for updates when a script is not specified.
|
UpdateRequestBuilder |
setDoc(Map source,
XContentType contentType)
Sets the doc to use for updates when a script is not specified.
|
UpdateRequestBuilder |
setDoc(Object... source)
Sets the doc to use for updates when a script is not specified, the doc provided
is a field and value pairs.
|
UpdateRequestBuilder |
setDoc(String source)
Sets the doc to use for updates when a script is not specified.
|
UpdateRequestBuilder |
setDoc(String field,
Object value)
Sets the doc to use for updates when a script is not specified.
|
UpdateRequestBuilder |
setDoc(XContentBuilder source)
Sets the doc to use for updates when a script is not specified.
|
UpdateRequestBuilder |
setDocAsUpsert(boolean shouldUpsertDoc)
Sets whether the specified doc parameter should be used as upsert document.
|
UpdateRequestBuilder |
setFields(String... fields)
Explicitly specify the fields that will be returned.
|
UpdateRequestBuilder |
setId(String id)
Sets the id of the indexed document.
|
UpdateRequestBuilder |
setParent(String parent) |
UpdateRequestBuilder |
setRefresh(boolean refresh)
Should a refresh be executed post this update operation causing the operation to
be searchable.
|
UpdateRequestBuilder |
setRetryOnConflict(int retryOnConflict)
Sets the number of retries of a version conflict occurs because the document was updated between
getting it and updating it.
|
UpdateRequestBuilder |
setRouting(String routing)
Controls the shard routing of the request.
|
UpdateRequestBuilder |
setScript(Script script)
The script to execute.
|
UpdateRequestBuilder |
setScriptedUpsert(boolean scriptedUpsert)
Sets whether the script should be run in the case of an insert
|
UpdateRequestBuilder |
setSource(byte[] source) |
UpdateRequestBuilder |
setSource(byte[] source,
int offset,
int length) |
UpdateRequestBuilder |
setSource(BytesReference source) |
UpdateRequestBuilder |
setSource(XContentBuilder source) |
UpdateRequestBuilder |
setTtl(Long ttl)
Set the new ttl of the document as a long.
|
UpdateRequestBuilder |
setTtl(String ttl)
Set the new ttl of the document as a time value expression.
|
UpdateRequestBuilder |
setTtl(TimeValue ttl)
Set the new ttl of the document as a
TimeValue instance. |
UpdateRequestBuilder |
setType(String type)
Sets the type of the indexed document.
|
UpdateRequestBuilder |
setUpsert(byte[] source)
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequestBuilder |
setUpsert(byte[] source,
int offset,
int length)
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequestBuilder |
setUpsert(IndexRequest indexRequest)
Sets the index request to be used if the document does not exists.
|
UpdateRequestBuilder |
setUpsert(Map source)
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequestBuilder |
setUpsert(Map source,
XContentType contentType)
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequestBuilder |
setUpsert(Object... source)
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequestBuilder |
setUpsert(String source)
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequestBuilder |
setUpsert(XContentBuilder source)
Sets the doc source of the update request to be used when the document does not exists.
|
UpdateRequestBuilder |
setVersion(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.
|
UpdateRequestBuilder |
setVersionType(VersionType versionType)
Sets the versioning type.
|
setIndex, setTimeout, setTimeout
beforeExecute, execute, execute, get, get, get, putHeader, request
public UpdateRequestBuilder(ElasticsearchClient client, UpdateAction action)
public UpdateRequestBuilder(ElasticsearchClient client, UpdateAction action, String index, String type, String id)
public UpdateRequestBuilder setType(String type)
public UpdateRequestBuilder setId(String id)
public UpdateRequestBuilder setRouting(String routing)
public UpdateRequestBuilder setParent(String parent)
public UpdateRequestBuilder setScript(Script script)
The script works with the variable ctx
, which is bound to the entry,
e.g. ctx._source.mycounter += 1
.
public UpdateRequestBuilder setFields(String... fields)
public UpdateRequestBuilder setRetryOnConflict(int retryOnConflict)
public UpdateRequestBuilder setVersion(long version)
public UpdateRequestBuilder setVersionType(VersionType versionType)
VersionType.INTERNAL
.public UpdateRequestBuilder setRefresh(boolean refresh)
public UpdateRequestBuilder setConsistencyLevel(WriteConsistencyLevel consistencyLevel)
WriteConsistencyLevel.DEFAULT
public UpdateRequestBuilder setDoc(IndexRequest indexRequest)
public UpdateRequestBuilder setDoc(XContentBuilder source)
public UpdateRequestBuilder setDoc(Map source)
public UpdateRequestBuilder setDoc(Map source, XContentType contentType)
public UpdateRequestBuilder setDoc(String source)
public UpdateRequestBuilder setDoc(byte[] source)
public UpdateRequestBuilder setDoc(byte[] source, int offset, int length)
public UpdateRequestBuilder setDoc(String field, Object value)
public UpdateRequestBuilder setDoc(Object... source)
public UpdateRequestBuilder setUpsert(IndexRequest indexRequest)
DocumentMissingException
is thrown.public UpdateRequestBuilder setUpsert(XContentBuilder source)
public UpdateRequestBuilder setUpsert(Map source)
public UpdateRequestBuilder setUpsert(Map source, XContentType contentType)
public UpdateRequestBuilder setUpsert(String source)
public UpdateRequestBuilder setUpsert(byte[] source)
public UpdateRequestBuilder setUpsert(byte[] source, int offset, int length)
public UpdateRequestBuilder setUpsert(Object... source)
public UpdateRequestBuilder setSource(XContentBuilder source) throws Exception
Exception
public UpdateRequestBuilder setSource(byte[] source) throws Exception
Exception
public UpdateRequestBuilder setSource(byte[] source, int offset, int length) throws Exception
Exception
public UpdateRequestBuilder setSource(BytesReference source) throws Exception
Exception
public UpdateRequestBuilder setDocAsUpsert(boolean shouldUpsertDoc)
public UpdateRequestBuilder setDetectNoop(boolean detectNoop)
public UpdateRequestBuilder setScriptedUpsert(boolean scriptedUpsert)
public UpdateRequestBuilder setTtl(Long ttl)
public UpdateRequestBuilder setTtl(String ttl)
public UpdateRequestBuilder setTtl(TimeValue ttl)
TimeValue
instance. Note that if detectNoop is true (the default)
and the source of the document isn't changed then the ttl update won't take
effect.Copyright © 2009–2017. All rights reserved.