Class UpdateRequest.Builder<TDocument,TPartialDocument>
java.lang.Object
co.elastic.clients.elasticsearch._core.UpdateRequest.Builder<TDocument,TPartialDocument>
- All Implemented Interfaces:
ObjectBuilder<UpdateRequest<TDocument,TPartialDocument>>
- Enclosing class:
- UpdateRequest<TDocument,TPartialDocument>
public static class UpdateRequest.Builder<TDocument,TPartialDocument> extends java.lang.Object implements ObjectBuilder<UpdateRequest<TDocument,TPartialDocument>>
Builder for
UpdateRequest
.-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
Modifier and Type Method Description UpdateRequest.Builder<TDocument,TPartialDocument>
addSourceExcludes(java.lang.String value)
Add a value tosourceExcludes(List)
, creating the list if needed.UpdateRequest.Builder<TDocument,TPartialDocument>
addSourceIncludes(java.lang.String value)
Add a value tosourceIncludes(List)
, creating the list if needed.UpdateRequest<TDocument,TPartialDocument>
build()
Builds aUpdateRequest
.UpdateRequest.Builder<TDocument,TPartialDocument>
detectNoop(java.lang.Boolean value)
Set to false to disable setting 'result' in the response to 'noop' if no change to the document occurred.UpdateRequest.Builder<TDocument,TPartialDocument>
doc(TPartialDocument value)
A partial update to an existing document.UpdateRequest.Builder<TDocument,TPartialDocument>
docAsUpsert(java.lang.Boolean value)
Set to true to use the contents of 'doc' as the value of 'upsert'UpdateRequest.Builder<TDocument,TPartialDocument>
id(java.lang.String value)
Required - Document IDUpdateRequest.Builder<TDocument,TPartialDocument>
ifPrimaryTerm(java.lang.Long value)
Only perform the operation if the document has this primary term.UpdateRequest.Builder<TDocument,TPartialDocument>
ifSeqNo(java.lang.Integer value)
Only perform the operation if the document has this sequence number.UpdateRequest.Builder<TDocument,TPartialDocument>
index(java.lang.String value)
Required - The name of the indexUpdateRequest.Builder<TDocument,TPartialDocument>
lang(java.lang.String value)
The script language.UpdateRequest.Builder<TDocument,TPartialDocument>
refresh(jakarta.json.JsonValue value)
If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search, if 'wait_for' then wait for a refresh to make this operation visible to search, if 'false' do nothing with refreshes.UpdateRequest.Builder<TDocument,TPartialDocument>
requireAlias(java.lang.Boolean value)
If true, the destination must be an index alias.UpdateRequest.Builder<TDocument,TPartialDocument>
retryOnConflict(java.lang.Long value)
Specify how many times should the operation be retried when a conflict occurs.UpdateRequest.Builder<TDocument,TPartialDocument>
routing(java.lang.String value)
Custom value used to route operations to a specific shard.UpdateRequest.Builder<TDocument,TPartialDocument>
script(jakarta.json.JsonValue value)
Script to execute to update the document.UpdateRequest.Builder<TDocument,TPartialDocument>
scriptedUpsert(java.lang.Boolean value)
Set to true to execute the script whether or not the document exists.UpdateRequest.Builder<TDocument,TPartialDocument>
source(jakarta.json.JsonValue value)
Set to false to disable source retrieval.UpdateRequest.Builder<TDocument,TPartialDocument>
sourceExcludes(java.lang.String... value)
Specify the source fields you want to exclude.UpdateRequest.Builder<TDocument,TPartialDocument>
sourceExcludes(java.util.List<java.lang.String> value)
Specify the source fields you want to exclude.UpdateRequest.Builder<TDocument,TPartialDocument>
sourceIncludes(java.lang.String... value)
Specify the source fields you want to retrieve.UpdateRequest.Builder<TDocument,TPartialDocument>
sourceIncludes(java.util.List<java.lang.String> value)
Specify the source fields you want to retrieve.UpdateRequest.Builder<TDocument,TPartialDocument>
tDocumentSerializer(JsonpSerializer<TDocument> value)
Serializer for TDocument.UpdateRequest.Builder<TDocument,TPartialDocument>
timeout(java.lang.String value)
Period to wait for dynamic mapping updates and active shards.UpdateRequest.Builder<TDocument,TPartialDocument>
tPartialDocumentSerializer(JsonpSerializer<TPartialDocument> value)
Serializer for TPartialDocument.UpdateRequest.Builder<TDocument,TPartialDocument>
type(java.lang.String value)
The type of the documentUpdateRequest.Builder<TDocument,TPartialDocument>
upsert(TDocument value)
If the document does not already exist, the contents of 'upsert' are inserted as a new document.UpdateRequest.Builder<TDocument,TPartialDocument>
waitForActiveShards(jakarta.json.JsonValue value)
The number of shard copies that must be active before proceeding with the operations.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
id
Required - Document IDAPI name:
id
-
index
Required - The name of the indexAPI name:
index
-
type
The type of the documentAPI name:
type
-
ifPrimaryTerm
public UpdateRequest.Builder<TDocument,TPartialDocument> ifPrimaryTerm(@Nullable java.lang.Long value)Only perform the operation if the document has this primary term.API name:
if_primary_term
-
ifSeqNo
public UpdateRequest.Builder<TDocument,TPartialDocument> ifSeqNo(@Nullable java.lang.Integer value)Only perform the operation if the document has this sequence number.API name:
if_seq_no
-
lang
The script language.API name:
lang
-
refresh
public UpdateRequest.Builder<TDocument,TPartialDocument> refresh(@Nullable jakarta.json.JsonValue value)If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search, if 'wait_for' then wait for a refresh to make this operation visible to search, if 'false' do nothing with refreshes.API name:
refresh
-
requireAlias
public UpdateRequest.Builder<TDocument,TPartialDocument> requireAlias(@Nullable java.lang.Boolean value)If true, the destination must be an index alias.API name:
require_alias
-
retryOnConflict
public UpdateRequest.Builder<TDocument,TPartialDocument> retryOnConflict(@Nullable java.lang.Long value)Specify how many times should the operation be retried when a conflict occurs.API name:
retry_on_conflict
-
routing
public UpdateRequest.Builder<TDocument,TPartialDocument> routing(@Nullable java.lang.String value)Custom value used to route operations to a specific shard.API name:
routing
-
timeout
public UpdateRequest.Builder<TDocument,TPartialDocument> timeout(@Nullable java.lang.String value)Period to wait for dynamic mapping updates and active shards. This guarantees Elasticsearch waits for at least the timeout before failing. The actual wait time could be longer, particularly when multiple waits occur.API name:
timeout
-
waitForActiveShards
public UpdateRequest.Builder<TDocument,TPartialDocument> waitForActiveShards(@Nullable jakarta.json.JsonValue value)The number of shard copies that must be active before proceeding with the operations. Set to 'all' or any positive integer up to the total number of shards in the index (number_of_replicas+1). Defaults to 1 meaning the primary shard.API name:
wait_for_active_shards
-
sourceExcludes
public UpdateRequest.Builder<TDocument,TPartialDocument> sourceExcludes(@Nullable java.util.List<java.lang.String> value)Specify the source fields you want to exclude.API name:
_source_excludes
-
sourceExcludes
public UpdateRequest.Builder<TDocument,TPartialDocument> sourceExcludes(java.lang.String... value)Specify the source fields you want to exclude.API name:
_source_excludes
-
addSourceExcludes
public UpdateRequest.Builder<TDocument,TPartialDocument> addSourceExcludes(java.lang.String value)Add a value tosourceExcludes(List)
, creating the list if needed. -
sourceIncludes
public UpdateRequest.Builder<TDocument,TPartialDocument> sourceIncludes(@Nullable java.util.List<java.lang.String> value)Specify the source fields you want to retrieve.API name:
_source_includes
-
sourceIncludes
public UpdateRequest.Builder<TDocument,TPartialDocument> sourceIncludes(java.lang.String... value)Specify the source fields you want to retrieve.API name:
_source_includes
-
addSourceIncludes
public UpdateRequest.Builder<TDocument,TPartialDocument> addSourceIncludes(java.lang.String value)Add a value tosourceIncludes(List)
, creating the list if needed. -
detectNoop
public UpdateRequest.Builder<TDocument,TPartialDocument> detectNoop(@Nullable java.lang.Boolean value)Set to false to disable setting 'result' in the response to 'noop' if no change to the document occurred.API name:
detect_noop
-
doc
A partial update to an existing document.API name:
doc
-
docAsUpsert
public UpdateRequest.Builder<TDocument,TPartialDocument> docAsUpsert(@Nullable java.lang.Boolean value)Set to true to use the contents of 'doc' as the value of 'upsert'API name:
doc_as_upsert
-
script
public UpdateRequest.Builder<TDocument,TPartialDocument> script(@Nullable jakarta.json.JsonValue value)Script to execute to update the document.API name:
script
-
scriptedUpsert
public UpdateRequest.Builder<TDocument,TPartialDocument> scriptedUpsert(@Nullable java.lang.Boolean value)Set to true to execute the script whether or not the document exists.API name:
scripted_upsert
-
source
public UpdateRequest.Builder<TDocument,TPartialDocument> source(@Nullable jakarta.json.JsonValue value)Set to false to disable source retrieval. You can also specify a comma-separated list of the fields you want to retrieve.API name:
_source
-
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 executed.API name:
upsert
-
tDocumentSerializer
public 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 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. -
build
Builds aUpdateRequest
.- Specified by:
build
in interfaceObjectBuilder<TDocument>
- Throws:
java.lang.NullPointerException
- if some of the required fields are null.
-