Class UpdateRequest<TDocument,TPartialDocument>
java.lang.Object
co.elastic.clients.elasticsearch._types.RequestBase
co.elastic.clients.elasticsearch._core.UpdateRequest<TDocument,TPartialDocument>
- All Implemented Interfaces:
ElasticsearchCommonRequest
,JsonpSerializable
public final class UpdateRequest<TDocument,TPartialDocument> extends RequestBase implements JsonpSerializable
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UpdateRequest.Builder<TDocument,TPartialDocument>
Builder forUpdateRequest
.Nested classes/interfaces inherited from class co.elastic.clients.elasticsearch._types.RequestBase
RequestBase.AbstractBuilder<BuilderT extends RequestBase.AbstractBuilder<BuilderT>>
-
Constructor Summary
Constructors Constructor Description UpdateRequest(UpdateRequest.Builder<TDocument,TPartialDocument> builder)
UpdateRequest(java.util.function.Function<UpdateRequest.Builder<TDocument,TPartialDocument>,UpdateRequest.Builder<TDocument,TPartialDocument>> fn)
-
Method Summary
Modifier and Type Method Description static <TDocument>
Endpoint<UpdateRequest<?,?>,UpdateResponse<TDocument>,ElasticsearchError>createUpdateEndpoint(JsonpDeserializer<TDocument> tDocumentDeserializer)
Create an "update
" endpoint.static <TDocument, TPartialDocument>
JsonpDeserializer<UpdateRequest<TDocument,TPartialDocument>>createUpdateRequestDeserializer(JsonpDeserializer<TDocument> tDocumentDeserializer, JsonpDeserializer<TPartialDocument> tPartialDocumentDeserializer)
Create a json deserializer for UpdateRequestjava.lang.Boolean
detectNoop()
Set to false to disable setting 'result' in the response to 'noop' if no change to the document occurred.TPartialDocument
doc()
A partial update to an existing document.java.lang.Boolean
docAsUpsert()
Set to true to use the contents of 'doc' as the value of 'upsert'java.lang.String
id()
Required - Document IDjava.lang.Long
ifPrimaryTerm()
Only perform the operation if the document has this primary term.java.lang.Integer
ifSeqNo()
Only perform the operation if the document has this sequence number.java.lang.String
index()
Required - The name of the indexjava.lang.String
lang()
The script language.jakarta.json.JsonValue
refresh()
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.java.lang.Boolean
requireAlias()
If true, the destination must be an index alias.java.lang.Long
retryOnConflict()
Specify how many times should the operation be retried when a conflict occurs.java.lang.String
routing()
Custom value used to route operations to a specific shard.jakarta.json.JsonValue
script()
Script to execute to update the document.java.lang.Boolean
scriptedUpsert()
Set to true to execute the script whether or not the document exists.void
serialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
Serialize this object to JSON.protected void
serializeInternal(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
protected static <TDocument, TPartialDocument>
voidsetupUpdateRequestDeserializer(DelegatingDeserializer<UpdateRequest.Builder<TDocument,TPartialDocument>> op, JsonpDeserializer<TDocument> tDocumentDeserializer, JsonpDeserializer<TPartialDocument> tPartialDocumentDeserializer)
jakarta.json.JsonValue
source()
Set to false to disable source retrieval.java.util.List<java.lang.String>
sourceExcludes()
Specify the source fields you want to exclude.java.util.List<java.lang.String>
sourceIncludes()
Specify the source fields you want to retrieve.java.lang.String
timeout()
Period to wait for dynamic mapping updates and active shards.java.lang.String
type()
The type of the documentTDocument
upsert()
If the document does not already exist, the contents of 'upsert' are inserted as a new document.jakarta.json.JsonValue
waitForActiveShards()
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
-
UpdateRequest
-
UpdateRequest
public UpdateRequest(java.util.function.Function<UpdateRequest.Builder<TDocument,TPartialDocument>,UpdateRequest.Builder<TDocument,TPartialDocument>> fn)
-
-
Method Details
-
id
public java.lang.String id()Required - Document IDAPI name:
id
-
index
public java.lang.String index()Required - The name of the indexAPI name:
index
-
type
@Nullable public java.lang.String type()The type of the documentAPI name:
type
-
ifPrimaryTerm
@Nullable public java.lang.Long ifPrimaryTerm()Only perform the operation if the document has this primary term.API name:
if_primary_term
-
ifSeqNo
@Nullable public java.lang.Integer ifSeqNo()Only perform the operation if the document has this sequence number.API name:
if_seq_no
-
lang
@Nullable public java.lang.String lang()The script language.API name:
lang
-
refresh
@Nullable public jakarta.json.JsonValue refresh()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
@Nullable public java.lang.Boolean requireAlias()If true, the destination must be an index alias.API name:
require_alias
-
retryOnConflict
@Nullable public java.lang.Long retryOnConflict()Specify how many times should the operation be retried when a conflict occurs.API name:
retry_on_conflict
-
routing
@Nullable public java.lang.String routing()Custom value used to route operations to a specific shard.API name:
routing
-
timeout
@Nullable public java.lang.String timeout()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
@Nullable public jakarta.json.JsonValue waitForActiveShards()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
@Nullable public java.util.List<java.lang.String> sourceExcludes()Specify the source fields you want to exclude.API name:
_source_excludes
-
sourceIncludes
@Nullable public java.util.List<java.lang.String> sourceIncludes()Specify the source fields you want to retrieve.API name:
_source_includes
-
detectNoop
@Nullable public java.lang.Boolean detectNoop()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
@Nullable public java.lang.Boolean docAsUpsert()Set to true to use the contents of 'doc' as the value of 'upsert'API name:
doc_as_upsert
-
script
@Nullable public jakarta.json.JsonValue script()Script to execute to update the document.API name:
script
-
scriptedUpsert
@Nullable public java.lang.Boolean scriptedUpsert()Set to true to execute the script whether or not the document exists.API name:
scripted_upsert
-
source
@Nullable public jakarta.json.JsonValue source()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
-
serialize
Serialize this object to JSON.- Specified by:
serialize
in interfaceJsonpSerializable
-
serializeInternal
-
createUpdateRequestDeserializer
public static <TDocument, TPartialDocument> JsonpDeserializer<UpdateRequest<TDocument,TPartialDocument>> createUpdateRequestDeserializer(JsonpDeserializer<TDocument> tDocumentDeserializer, JsonpDeserializer<TPartialDocument> tPartialDocumentDeserializer)Create a json deserializer for UpdateRequest -
setupUpdateRequestDeserializer
protected static <TDocument, TPartialDocument> void setupUpdateRequestDeserializer(DelegatingDeserializer<UpdateRequest.Builder<TDocument,TPartialDocument>> op, JsonpDeserializer<TDocument> tDocumentDeserializer, JsonpDeserializer<TPartialDocument> tPartialDocumentDeserializer) -
createUpdateEndpoint
public static <TDocument> Endpoint<UpdateRequest<?,?>,UpdateResponse<TDocument>,ElasticsearchError> createUpdateEndpoint(JsonpDeserializer<TDocument> tDocumentDeserializer)Create an "update
" endpoint.
-