Class DeleteByQueryDescriptor<TDocument>
Delete documents that match a given query
Inheritance
DeleteByQueryDescriptor<TDocument>
Assembly: OpenSearch.Client.dll
Syntax
public class DeleteByQueryDescriptor<TDocument> : RequestDescriptorBase<DeleteByQueryDescriptor<TDocument>, DeleteByQueryRequestParameters, IDeleteByQueryRequest<TDocument>>, IDescriptor, IDeleteByQueryRequest<TDocument>, IDeleteByQueryRequest, IRequest<DeleteByQueryRequestParameters>, IRequest where TDocument : class
Type Parameters
Name |
Description |
TDocument |
|
Constructors
|
Edit this page
View Source
DeleteByQueryDescriptor()
/{index}/_delete_by_query
Declaration
public DeleteByQueryDescriptor()
|
Edit this page
View Source
DeleteByQueryDescriptor(Indices)
/{index}/_delete_by_query
Declaration
public DeleteByQueryDescriptor(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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<TDocument> Analyzer(string analyzer)
Parameters
Type |
Name |
Description |
string |
analyzer |
|
Returns
|
Edit this page
View Source
Conflicts(Conflicts?)
What to do if delete by query hits version conflicts: abort
or proceed
.
Declaration
public DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<TDocument> ExpandWildcards(ExpandWildcards? expandwildcards)
Parameters
Returns
|
Edit this page
View Source
From(long?)
Declaration
public DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<TDocument> Lenient(bool? lenient = true)
Parameters
Type |
Name |
Description |
bool? |
lenient |
|
Returns
|
Edit this page
View Source
MatchAll()
Declaration
public DeleteByQueryDescriptor<TDocument> MatchAll()
Returns
|
Edit this page
View Source
MaximumDocuments(long?)
Limit the number of processed documents
Declaration
public DeleteByQueryDescriptor<TDocument> MaximumDocuments(long? maximumDocuments)
Parameters
Type |
Name |
Description |
long? |
maximumDocuments |
|
Returns
|
Edit this page
View Source
Preference(string)
Specifies the node or shard the operation should be performed on. Random by default.
Declaration
public DeleteByQueryDescriptor<TDocument> Preference(string preference)
Parameters
Type |
Name |
Description |
string |
preference |
|
Returns
|
Edit this page
View Source
Query(Func<QueryContainerDescriptor<TDocument>, QueryContainer>)
The query to use to select documents for deletion
Declaration
public DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<TDocument> QueryOnQueryString(string queryonquerystring)
Parameters
Type |
Name |
Description |
string |
queryonquerystring |
|
Returns
|
Edit this page
View Source
Refresh(bool?)
If true
, OpenSearch refreshes all shards involved in the delete by query after the request completes.
Declaration
public DeleteByQueryDescriptor<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. Defaults to the index-level setting.
Declaration
public DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<TDocument> Routing(Routing routing)
Parameters
Type |
Name |
Description |
Routing |
routing |
|
Returns
|
Edit this page
View Source
Period to retain the search context for scrolling.
Declaration
public DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<TDocument> ScrollSize(long? scrollsize)
Parameters
Type |
Name |
Description |
long? |
scrollsize |
|
Returns
|
Edit this page
View Source
SearchTimeout(Time)
Explicit timeout for each search request. Defaults to no timeout.
Declaration
public DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<TDocument> SearchType(SearchType? searchtype)
Parameters
Returns
|
Edit this page
View Source
Size(long?)
Deprecated, please use max_docs
instead.
Declaration
public DeleteByQueryDescriptor<TDocument> Size(long? size)
Parameters
Type |
Name |
Description |
long? |
size |
|
Returns
|
Edit this page
View Source
Parallelize the deleting process. This parallelization can improve efficiency and
provide a convenient way to break the request down into smaller parts.
Declaration
public DeleteByQueryDescriptor<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.
Declaration
public DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<TDocument> TerminateAfter(long? terminateafter)
Parameters
Type |
Name |
Description |
long? |
terminateafter |
|
Returns
|
Edit this page
View Source
Timeout(Time)
Period each deletion request waits for active shards.
Declaration
public DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<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 DeleteByQueryDescriptor<TDocument> WaitForCompletion(bool? waitforcompletion = true)
Parameters
Type |
Name |
Description |
bool? |
waitforcompletion |
|
Returns
Implements
Extension Methods