Class UpdateRequest.Builder<TDocument,TPartialDocument>
java.lang.Object
co.elastic.clients.util.ObjectBuilderBase
co.elastic.clients.util.WithJsonObjectBuilderBase<BuilderT>
co.elastic.clients.elasticsearch._types.RequestBase.AbstractBuilder<UpdateRequest.Builder<TDocument,TPartialDocument>>
co.elastic.clients.elasticsearch.core.UpdateRequest.Builder<TDocument,TPartialDocument>
- All Implemented Interfaces:
WithJson<UpdateRequest.Builder<TDocument,
,TPartialDocument>> ObjectBuilder<UpdateRequest<TDocument,
TPartialDocument>>
- Enclosing class:
- UpdateRequest<TDocument,
TPartialDocument>
public static class UpdateRequest.Builder<TDocument,TPartialDocument>
extends RequestBase.AbstractBuilder<UpdateRequest.Builder<TDocument,TPartialDocument>>
implements ObjectBuilder<UpdateRequest<TDocument,TPartialDocument>>
Builder for
UpdateRequest
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds aUpdateRequest
.detectNoop
(Boolean value) Iftrue
, theresult
in the response is set tonoop
(no operation) when there are no changes to the document.doc
(TPartialDocument value) A partial update to an existing document.docAsUpsert
(Boolean value) Iftrue
, use the contents of 'doc' as the value of 'upsert'.Required - A unique identifier for the document to be updated.ifPrimaryTerm
(Long value) Only perform the operation if the document has this primary term.Only perform the operation if the document has this sequence number.includeSourceOnError
(Boolean value) True or false if to include the document source in the error message in case of parsing errors.Required - The name of the target index.The script language.If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search.requireAlias
(Boolean value) Iftrue
, the destination must be an index alias.retryOnConflict
(Integer value) The number of times the operation should be retried when a conflict occurs.A custom value used to route operations to a specific shard.The script to run to update the document.The script to run to update the document.scriptedUpsert
(Boolean value) Iftrue
, run the script whether or not the document exists.protected UpdateRequest.Builder<TDocument,
TPartialDocument> self()
source
(SourceConfig value) Iffalse
, turn off source retrieval.Iffalse
, turn off source retrieval.Serializer for TDocument.The period to wait for the following operations: dynamic mapping updates and waiting for active shards.The period to wait for the following operations: dynamic mapping updates and waiting for active shards.Serializer for TPartialDocument.If the document does not already exist, the contents of 'upsert' are inserted as a new document.The number of copies of each shard that must be active before proceeding with the operation.The number of copies of each shard that must be active before proceeding with the operation.Methods inherited from class co.elastic.clients.util.WithJsonObjectBuilderBase
withJson
Methods inherited from class co.elastic.clients.util.ObjectBuilderBase
_checkSingleUse, _listAdd, _listAddAll, _mapPut, _mapPutAll
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
source
Iffalse
, turn off source retrieval. You can also specify a comma-separated list of the fields you want to retrieve.API name:
_source
-
source
public final UpdateRequest.Builder<TDocument,TPartialDocument> source(Function<SourceConfig.Builder, ObjectBuilder<SourceConfig>> fn) Iffalse
, turn off source retrieval. You can also specify a comma-separated list of the fields you want to retrieve.API name:
_source
-
detectNoop
Iftrue
, theresult
in the response is set tonoop
(no operation) when there are no changes to the document.API name:
detect_noop
-
doc
public final UpdateRequest.Builder<TDocument,TPartialDocument> doc(@Nullable TPartialDocument value) A partial update to an existing document. If bothdoc
andscript
are specified,doc
is ignored.API name:
doc
-
docAsUpsert
Iftrue
, use the contents of 'doc' as the value of 'upsert'. NOTE: Using ingest pipelines withdoc_as_upsert
is not supported.API name:
doc_as_upsert
-
id
Required - A unique identifier for the document to be updated.API name:
id
-
ifPrimaryTerm
Only perform the operation if the document has this primary term.API name:
if_primary_term
-
ifSeqNo
Only perform the operation if the document has this sequence number.API name:
if_seq_no
-
includeSourceOnError
public final UpdateRequest.Builder<TDocument,TPartialDocument> includeSourceOnError(@Nullable Boolean value) True or false if to include the document source in the error message in case of parsing errors.API name:
include_source_on_error
-
index
Required - The name of the target index. By default, the index is created automatically if it doesn't exist.API name:
index
-
lang
The script language.API name:
lang
-
refresh
If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. If 'wait_for', it waits for a refresh to make this operation visible to search. If 'false', it does nothing with refreshes.API name:
refresh
-
requireAlias
public final UpdateRequest.Builder<TDocument,TPartialDocument> requireAlias(@Nullable Boolean value) Iftrue
, the destination must be an index alias.API name:
require_alias
-
retryOnConflict
public final UpdateRequest.Builder<TDocument,TPartialDocument> retryOnConflict(@Nullable Integer value) The number of times the operation should be retried when a conflict occurs.API name:
retry_on_conflict
-
routing
A custom value used to route operations to a specific shard.API name:
routing
-
script
The script to run to update the document.API name:
script
-
script
public final UpdateRequest.Builder<TDocument,TPartialDocument> script(Function<Script.Builder, ObjectBuilder<Script>> fn) The script to run to update the document.API name:
script
-
scriptedUpsert
public final UpdateRequest.Builder<TDocument,TPartialDocument> scriptedUpsert(@Nullable Boolean value) Iftrue
, run the script whether or not the document exists.API name:
scripted_upsert
-
timeout
The period to wait for the following operations: dynamic mapping updates and waiting for active shards. Elasticsearch waits for at least the timeout period before failing. The actual wait time could be longer, particularly when multiple waits occur.API name:
timeout
-
timeout
public final UpdateRequest.Builder<TDocument,TPartialDocument> timeout(Function<Time.Builder, ObjectBuilder<Time>> fn) The period to wait for the following operations: dynamic mapping updates and waiting for active shards. Elasticsearch waits for at least the timeout period before failing. The actual wait time could be longer, particularly when multiple waits occur.API name:
timeout
-
upsert
If the document does not already exist, the contents of 'upsert' are inserted as a new document. If the document exists, the 'script' is run.API name:
upsert
-
waitForActiveShards
public final UpdateRequest.Builder<TDocument,TPartialDocument> waitForActiveShards(@Nullable WaitForActiveShards value) The number of copies of each shard that must be active before proceeding with the operation. Set to 'all' or any positive integer up to the total number of shards in the index (number_of_replicas
+1). The default value of1
means it waits for each primary shard to be active.API name:
wait_for_active_shards
-
waitForActiveShards
public final UpdateRequest.Builder<TDocument,TPartialDocument> waitForActiveShards(Function<WaitForActiveShards.Builder, ObjectBuilder<WaitForActiveShards>> fn) The number of copies of each shard that must be active before proceeding with the operation. Set to 'all' or any positive integer up to the total number of shards in the index (number_of_replicas
+1). The default value of1
means it waits for each primary shard to be active.API name:
wait_for_active_shards
-
tDocumentSerializer
public final UpdateRequest.Builder<TDocument,TPartialDocument> tDocumentSerializer(@Nullable JsonpSerializer<TDocument> value) Serializer for TDocument. If not set, an attempt will be made to find a serializer from the JSON context. -
tPartialDocumentSerializer
public final UpdateRequest.Builder<TDocument,TPartialDocument> tPartialDocumentSerializer(@Nullable JsonpSerializer<TPartialDocument> value) Serializer for TPartialDocument. If not set, an attempt will be made to find a serializer from the JSON context. -
self
- Specified by:
self
in classRequestBase.AbstractBuilder<UpdateRequest.Builder<TDocument,
TPartialDocument>>
-
build
Builds aUpdateRequest
.- Specified by:
build
in interfaceObjectBuilder<TDocument>
- Throws:
NullPointerException
- if some of the required fields are null.
-