Class UpdateRequest<TDocument, TPartialDocument>
Request for Update
https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/update-document/
Inheritance
Inherited Members
Namespace: OpenSearch.Client
Assembly: OpenSearch.Client.dll
Syntax
public class UpdateRequest<TDocument, TPartialDocument> : PlainRequestBase<UpdateRequestParameters>, IUpdateRequest<TDocument, TPartialDocument>, IRequest<UpdateRequestParameters>, IRequest where TDocument : class where TPartialDocument : class
Type Parameters
Name | Description |
---|---|
TDocument | |
TPartialDocument |
Constructors
| Edit this page View SourceUpdateRequest()
Used for serialization purposes, making sure we have a parameterless constructor
Declaration
protected UpdateRequest()
UpdateRequest(Id)
/{index}/_update/{id}
Declaration
public UpdateRequest(Id id)
Parameters
Type | Name | Description |
---|---|---|
Id | id | this parameter is required |
UpdateRequest(IndexName, Id)
/{index}/_update/{id}
Declaration
public UpdateRequest(IndexName index, Id id)
Parameters
Type | Name | Description |
---|---|---|
IndexName | index | this parameter is required |
Id | id | this parameter is required |
UpdateRequest(TDocument, IndexName, Id)
/{index}/_update/{id}
Declaration
public UpdateRequest(TDocument documentWithId, IndexName index = null, Id id = null)
Parameters
Type | Name | Description |
---|---|---|
TDocument | documentWithId | |
IndexName | index | |
Id | id | The document used to resolve the path from |
Properties
| Edit this page View SourceDetectNoop
Declaration
public bool? DetectNoop { get; set; }
Property Value
Type | Description |
---|---|
bool? |
Doc
Declaration
public TPartialDocument Doc { get; set; }
Property Value
Type | Description |
---|---|
TPartialDocument |
DocAsUpsert
Declaration
public bool? DocAsUpsert { get; set; }
Property Value
Type | Description |
---|---|
bool? |
IfPrimaryTerm
only perform the update operation if the last operation that has changed the document has the specified primary term
Declaration
public long? IfPrimaryTerm { get; set; }
Property Value
Type | Description |
---|---|
long? |
IfSequenceNumber
only perform the update operation if the last operation that has changed the document has the specified sequence number
Declaration
public long? IfSequenceNumber { get; set; }
Property Value
Type | Description |
---|---|
long? |
Lang
The script language (default: painless)
Declaration
public string Lang { get; set; }
Property Value
Type | Description |
---|---|
string |
Refresh
If true
then refresh 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
(the default) then do nothing with refreshes.
Declaration
public Refresh? Refresh { get; set; }
Property Value
Type | Description |
---|---|
Refresh? |
RequireAlias
When true, requires destination is an alias. Default is false
Declaration
public bool? RequireAlias { get; set; }
Property Value
Type | Description |
---|---|
bool? |
RetryOnConflict
Specify how many times should the operation be retried when a conflict occurs (default: 0)
Declaration
public long? RetryOnConflict { get; set; }
Property Value
Type | Description |
---|---|
long? |
Routing
A document is routed to a particular shard in an index using the following formula
shard_num = hash(_routing) % num_primary_shards
OpenSearch will use the document id if not provided.
For requests that are constructed from/for a document OSC will automatically infer the routing key if that document has a JoinField or a routing mapping on for its type exists on ConnectionSettings
Declaration
public Routing Routing { get; set; }
Property Value
Type | Description |
---|---|
Routing |
Script
Declaration
public IScript Script { get; set; }
Property Value
Type | Description |
---|---|
IScript |
ScriptedUpsert
If you would like your script to run regardless of whether the document exists or not — i.e. the script handles initializing the document instead of the upsert element — then set scripted_upsert to true
Declaration
public bool? ScriptedUpsert { get; set; }
Property Value
Type | Description |
---|---|
bool? |
Self
Declaration
protected IUpdateRequest<TDocument, TPartialDocument> Self { get; }
Property Value
Type | Description |
---|---|
IUpdateRequest<TDocument, TPartialDocument> |
Source
Declaration
public Union<bool, ISourceFilter> Source { get; set; }
Property Value
Type | Description |
---|---|
Union<bool, ISourceFilter> |
SourceEnabled
Whether the _source should be included in the response.
Declaration
public bool? SourceEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool? |
Timeout
Explicit operation timeout
Declaration
public Time Timeout { get; set; }
Property Value
Type | Description |
---|---|
Time |
Upsert
Declaration
public TDocument Upsert { get; set; }
Property Value
Type | Description |
---|---|
TDocument |
WaitForActiveShards
Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard
only. Set to all
for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the
shard (number of replicas + 1)
Declaration
public string WaitForActiveShards { get; set; }
Property Value
Type | Description |
---|---|
string |