Class UpdateByQueryDescriptor<TDocument>
Descriptor for UpdateByQuery
https://opensearch.org/docs/latest/api-reference/document-apis/update-by-query/
Inheritance
UpdateByQueryDescriptor<TDocument>
Assembly: OpenSearch.Client.dll
Syntax
public class UpdateByQueryDescriptor<TDocument> : RequestDescriptorBase<UpdateByQueryDescriptor<TDocument>, UpdateByQueryRequestParameters, IUpdateByQueryRequest<TDocument>>, IDescriptor, IUpdateByQueryRequest<TDocument>, IUpdateByQueryRequest, IRequest<UpdateByQueryRequestParameters>, IRequest where TDocument : class
Type Parameters
Name |
Description |
TDocument |
|
Constructors
|
Edit this page
View Source
UpdateByQueryDescriptor()
/{index}/_update_by_query
Declaration
public UpdateByQueryDescriptor()
|
Edit this page
View Source
UpdateByQueryDescriptor(Indices)
/{index}/_update_by_query
Declaration
public UpdateByQueryDescriptor(Indices index)
Parameters
Type |
Name |
Description |
Indices |
index |
this parameter is required
|
Methods
|
Edit this page
View Source
AllIndices()
A shortcut into calling Index(Indices.All)
Declaration
public UpdateByQueryDescriptor<TDocument> AllIndices()
Returns
|
Edit this page
View Source
AllowNoIndices(bool?)
If false
, the request returns an error if any wildcard expression, index alias, or _all
value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar*
returns an error if an index starts with foo
but no index starts with bar
.
Declaration
public UpdateByQueryDescriptor<TDocument> AllowNoIndices(bool? allownoindices = true)
Parameters
Type |
Name |
Description |
bool? |
allownoindices |
|
Returns
|
Edit this page
View Source
AnalyzeWildcard(bool?)
If true
, wildcard and prefix queries are analyzed.
Declaration
public UpdateByQueryDescriptor<TDocument> AnalyzeWildcard(bool? analyzewildcard = true)
Parameters
Type |
Name |
Description |
bool? |
analyzewildcard |
|
Returns
|
Edit this page
View Source
Analyzer(string)
Analyzer to use for the query string.
Declaration
public UpdateByQueryDescriptor<TDocument> Analyzer(string analyzer)
Parameters
Type |
Name |
Description |
string |
analyzer |
|
Returns
|
Edit this page
View Source
Conflicts(Conflicts?)
What to do if update by query hits version conflicts: abort
or proceed
.
Declaration
public UpdateByQueryDescriptor<TDocument> Conflicts(Conflicts? conflicts)
Parameters
Returns
|
Edit this page
View Source
DefaultOperator(DefaultOperator?)
The default operator for query string query: AND
or OR
.
Declaration
public UpdateByQueryDescriptor<TDocument> DefaultOperator(DefaultOperator? defaultoperator)
Parameters
Returns
|
Edit this page
View Source
Df(string)
Field to use as default where no field prefix is given in the query string.
Declaration
public UpdateByQueryDescriptor<TDocument> Df(string df)
Parameters
Type |
Name |
Description |
string |
df |
|
Returns
|
Edit this page
View Source
ExpandWildcards(ExpandWildcards?)
Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden
. Valid values are: all
, open
, closed
, hidden
, none
.
Declaration
public UpdateByQueryDescriptor<TDocument> ExpandWildcards(ExpandWildcards? expandwildcards)
Parameters
Returns
|
Edit this page
View Source
From(long?)
Declaration
public UpdateByQueryDescriptor<TDocument> From(long? from)
Parameters
Type |
Name |
Description |
long? |
from |
|
Returns
|
Edit this page
View Source
IgnoreUnavailable(bool?)
If false
, the request returns an error if it targets a missing or closed index.
Declaration
public UpdateByQueryDescriptor<TDocument> IgnoreUnavailable(bool? ignoreunavailable = true)
Parameters
Type |
Name |
Description |
bool? |
ignoreunavailable |
|
Returns
|
Edit this page
View Source
Index(Indices)
Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (*
). To search all data streams or indices, omit this parameter or use *
or _all
.
Declaration
public UpdateByQueryDescriptor<TDocument> Index(Indices index)
Parameters
Type |
Name |
Description |
Indices |
index |
|
Returns
|
Edit this page
View Source
Index<TOther>()
a shortcut into calling Index(typeof(TOther))
Declaration
public UpdateByQueryDescriptor<TDocument> Index<TOther>() where TOther : class
Returns
Type Parameters
|
Edit this page
View Source
Lenient(bool?)
If true
, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.
Declaration
public UpdateByQueryDescriptor<TDocument> Lenient(bool? lenient = true)
Parameters
Type |
Name |
Description |
bool? |
lenient |
|
Returns
|
Edit this page
View Source
MatchAll()
Query that selects all documents
Declaration
public UpdateByQueryDescriptor<TDocument> MatchAll()
Returns
|
Edit this page
View Source
MaximumDocuments(long?)
Limit the number of processed documents
Declaration
public UpdateByQueryDescriptor<TDocument> MaximumDocuments(long? maximumDocuments)
Parameters
Type |
Name |
Description |
long? |
maximumDocuments |
|
Returns
|
Edit this page
View Source
Pipeline(string)
ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to _none
disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter.
Declaration
public UpdateByQueryDescriptor<TDocument> Pipeline(string pipeline)
Parameters
Type |
Name |
Description |
string |
pipeline |
|
Returns
|
Edit this page
View Source
Preference(string)
Specifies the node or shard the operation should be performed on. Random by default.
Declaration
public UpdateByQueryDescriptor<TDocument> Preference(string preference)
Parameters
Type |
Name |
Description |
string |
preference |
|
Returns
|
Edit this page
View Source
Query(Func<QueryContainerDescriptor<TDocument>, QueryContainer>)
Query to select documents to update
Declaration
public UpdateByQueryDescriptor<TDocument> Query(Func<QueryContainerDescriptor<TDocument>, QueryContainer> querySelector)
Parameters
Returns
|
Edit this page
View Source
QueryOnQueryString(string)
Query in the Lucene query string syntax.
Declaration
public UpdateByQueryDescriptor<TDocument> QueryOnQueryString(string queryonquerystring)
Parameters
Type |
Name |
Description |
string |
queryonquerystring |
|
Returns
|
Edit this page
View Source
Refresh(bool?)
If true
, OpenSearch refreshes affected shards to make the operation visible to search.
Declaration
public UpdateByQueryDescriptor<TDocument> Refresh(bool? refresh = true)
Parameters
Type |
Name |
Description |
bool? |
refresh |
|
Returns
|
Edit this page
View Source
RequestCache(bool?)
If true
, the request cache is used for this request.
Declaration
public UpdateByQueryDescriptor<TDocument> RequestCache(bool? requestcache = true)
Parameters
Type |
Name |
Description |
bool? |
requestcache |
|
Returns
|
Edit this page
View Source
RequestsPerSecond(long?)
The throttle for this request in sub-requests per second.
Declaration
public UpdateByQueryDescriptor<TDocument> RequestsPerSecond(long? requestspersecond)
Parameters
Type |
Name |
Description |
long? |
requestspersecond |
|
Returns
|
Edit this page
View Source
Routing(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 OpenSearch.Client 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 UpdateByQueryDescriptor<TDocument> Routing(Routing routing)
Parameters
Type |
Name |
Description |
Routing |
routing |
|
Returns
|
Edit this page
View Source
Script(Func<ScriptDescriptor, IScript>)
A script specifying the update to make
Declaration
public UpdateByQueryDescriptor<TDocument> Script(Func<ScriptDescriptor, IScript> scriptSelector)
Parameters
Returns
|
Edit this page
View Source
Script(string)
A script specifying the update to make
Declaration
public UpdateByQueryDescriptor<TDocument> Script(string script)
Parameters
Type |
Name |
Description |
string |
script |
|
Returns
|
Edit this page
View Source
Period to retain the search context for scrolling.
Declaration
public UpdateByQueryDescriptor<TDocument> Scroll(Time scroll)
Parameters
Type |
Name |
Description |
Time |
scroll |
|
Returns
|
Edit this page
View Source
Size of the scroll request that powers the operation.
Declaration
public UpdateByQueryDescriptor<TDocument> ScrollSize(long? scrollsize)
Parameters
Type |
Name |
Description |
long? |
scrollsize |
|
Returns
|
Edit this page
View Source
SearchTimeout(Time)
Explicit timeout for each search request.
Declaration
public UpdateByQueryDescriptor<TDocument> SearchTimeout(Time searchtimeout)
Parameters
Type |
Name |
Description |
Time |
searchtimeout |
|
Returns
|
Edit this page
View Source
SearchType(SearchType?)
The type of the search operation. Available options: query_then_fetch
, dfs_query_then_fetch
.
Declaration
public UpdateByQueryDescriptor<TDocument> SearchType(SearchType? searchtype)
Parameters
Returns
|
Edit this page
View Source
Size(long?)
Deprecated, please use max_docs
instead.
Declaration
public UpdateByQueryDescriptor<TDocument> Size(long? size)
Parameters
Type |
Name |
Description |
long? |
size |
|
Returns
|
Edit this page
View Source
Parallelize the update process by splitting a query into
multiple slices.
Declaration
public UpdateByQueryDescriptor<TDocument> Slice(Func<SlicedScrollDescriptor<TDocument>, ISlicedScroll> selector)
Parameters
Returns
|
Edit this page
View Source
Slices(Slices)
The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to auto
.
Declaration
public UpdateByQueryDescriptor<TDocument> Slices(Slices slices)
Parameters
Type |
Name |
Description |
Slices |
slices |
|
Returns
|
Edit this page
View Source
Sort(params string[])
A comma-separated list of <field>:<direction> pairs.
Declaration
public UpdateByQueryDescriptor<TDocument> Sort(params string[] sort)
Parameters
Type |
Name |
Description |
string[] |
sort |
|
Returns
|
Edit this page
View Source
SourceEnabled(bool?)
Whether the _source should be included in the response.
Declaration
public UpdateByQueryDescriptor<TDocument> SourceEnabled(bool? sourceenabled = true)
Parameters
Type |
Name |
Description |
bool? |
sourceenabled |
|
Returns
|
Edit this page
View Source
SourceExcludes(Fields)
List of fields to exclude from the returned _source field.
Declaration
public UpdateByQueryDescriptor<TDocument> SourceExcludes(Fields sourceexcludes)
Parameters
Type |
Name |
Description |
Fields |
sourceexcludes |
|
Returns
|
Edit this page
View Source
SourceExcludes(params Expression<Func<TDocument, object>>[])
List of fields to exclude from the returned _source field.
Declaration
public UpdateByQueryDescriptor<TDocument> SourceExcludes(params Expression<Func<TDocument, object>>[] fields)
Parameters
Returns
|
Edit this page
View Source
SourceIncludes(Fields)
List of fields to extract and return from the _source field.
Declaration
public UpdateByQueryDescriptor<TDocument> SourceIncludes(Fields sourceincludes)
Parameters
Type |
Name |
Description |
Fields |
sourceincludes |
|
Returns
|
Edit this page
View Source
SourceIncludes(params Expression<Func<TDocument, object>>[])
List of fields to extract and return from the _source field.
Declaration
public UpdateByQueryDescriptor<TDocument> SourceIncludes(params Expression<Func<TDocument, object>>[] fields)
Parameters
Returns
|
Edit this page
View Source
Stats(params string[])
Specific tag
of the request for logging and statistical purposes.
Declaration
public UpdateByQueryDescriptor<TDocument> Stats(params string[] stats)
Parameters
Type |
Name |
Description |
string[] |
stats |
|
Returns
|
Edit this page
View Source
TerminateAfter(long?)
Maximum number of documents to collect for each shard. If a query reaches this limit, OpenSearch terminates the query early. OpenSearch collects documents before sorting. Use with caution. OpenSearch applies this parameter to each shard handling the request. When possible, let OpenSearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers.
Declaration
public UpdateByQueryDescriptor<TDocument> TerminateAfter(long? terminateafter)
Parameters
Type |
Name |
Description |
long? |
terminateafter |
|
Returns
|
Edit this page
View Source
Timeout(Time)
Period each update request waits for the following operations: dynamic mapping updates, waiting for active shards.
Declaration
public UpdateByQueryDescriptor<TDocument> Timeout(Time timeout)
Parameters
Type |
Name |
Description |
Time |
timeout |
|
Returns
|
Edit this page
View Source
Version(bool?)
If true
, returns the document version as part of a hit.
Declaration
public UpdateByQueryDescriptor<TDocument> Version(bool? version = true)
Parameters
Type |
Name |
Description |
bool? |
version |
|
Returns
|
Edit this page
View Source
WaitForActiveShards(string)
The number of shard copies 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
).
Declaration
public UpdateByQueryDescriptor<TDocument> WaitForActiveShards(string waitforactiveshards)
Parameters
Type |
Name |
Description |
string |
waitforactiveshards |
|
Returns
|
Edit this page
View Source
WaitForCompletion(bool?)
If true
, the request blocks until the operation is complete.
Declaration
public UpdateByQueryDescriptor<TDocument> WaitForCompletion(bool? waitforcompletion = true)
Parameters
Type |
Name |
Description |
bool? |
waitforcompletion |
|
Returns
Implements
Extension Methods