Menu
Delete by query
Delete by query
/{index}/_delete_by_queryUse it in a workflow
- Add a step and choose the OpenSearch connector.
- Pick the Delete by query action (under core).
- Fill in the fields below, then reference the result from later steps as
{{deleteByQuery.response.data}}.
Request
Path parameters
indexoneOfrequiredA comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (`*`). To search all data streams or indexes, omit this parameter or use `*` or `_all`.
Query parameters
_sourceoneOfSet to `true` or `false` to return the `_source` field or not, or a list of fields to return.
_source_excludesarray<string>List of fields to exclude from the returned `_source` field.
_source_includesarray<string>List of fields to extract and return from the `_source` field.
allow_no_indicesbooleanIf `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.
analyze_wildcardbooleanIf `true`, wildcard and prefix queries are analyzed.
Default false
analyzerstringAnalyzer to use for the query string.
conflictsoneOfWhat to do if delete by query hits version conflicts: `abort` or `proceed`.
default_operatorstringThe default operator for query string query: `AND` or `OR`.
dfstringField to use as default where no field prefix is given in the query string.
expand_wildcardsoneOfType 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`.
frominteger (int32)Starting offset.
Default 0
ignore_unavailablebooleanIf `false`, the request returns an error if it targets a missing or closed index.
lenientbooleanIf `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.
max_docsinteger (int32)Maximum number of documents to process. Defaults to all documents.
preferencestringSpecifies the node or shard the operation should be performed on. Random by default.
Default "random"
qstringQuery in the Lucene query string syntax.
refreshoneOfIf `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes.
request_cachebooleanIf `true`, the request cache is used for this request. Defaults to the index-level setting.
requests_per_secondnumber (float)The throttle for this request in sub-requests per second.
Default 0
routingoneOfA custom value used to route operations to a specific shard.
scrollstringPeriod to retain the search context for scrolling.
scroll_sizeinteger (int32)Size of the scroll request that powers the operation.
Default 100
search_timeoutstringExplicit timeout for each search request. Defaults to no timeout.
search_typeoneOfThe type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`.
sizeinteger (int32)Deprecated, use `max_docs` instead.
slicesoneOfThe number of slices this task should be divided into.
sortarray<string>A comma-separated list of <field>:<direction> pairs.
statsarray<string>Specific `tag` of the request for logging and statistical purposes.
terminate_afterinteger (int32)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 indexes across multiple data tiers.
timeoutstringPeriod each deletion request waits for active shards.
versionbooleanIf `true`, returns the document version as part of a hit.
wait_for_active_shardsoneOfThe 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`).
wait_for_completionbooleanIf `true`, the request blocks until the operation is complete.
Default true
prettybooleanWhether to pretty-format the returned JSON response.
Default false
humanbooleanWhether to return human-readable values for statistics.
Default false
error_tracebooleanWhether to include the stack trace of returned errors.
Default false
sourcestringThe URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
filter_pathoneOfA comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`.
Response
Returns 200 with a oneOf. Read it in later steps with {{deleteByQuery.response.data.<field>}}.
Need more? See the OpenSearch guide for connection setup and behaviour shared by every action.