younifyd
Menu

Delete by query

Delete by query

POST/{index}/_delete_by_query

Use it in a workflow

  1. Add a step and choose the OpenSearch connector.
  2. Pick the Delete by query action (under core).
  3. Fill in the fields below, then reference the result from later steps as {{deleteByQuery.response.data}}.

Request

Path parameters

indexoneOfrequired

A 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

_sourceoneOf

Set 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_indicesboolean

If `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_wildcardboolean

If `true`, wildcard and prefix queries are analyzed.

Default false

analyzerstring

Analyzer to use for the query string.

conflictsoneOf

What to do if delete by query hits version conflicts: `abort` or `proceed`.

default_operatorstring

The default operator for query string query: `AND` or `OR`.

dfstring

Field to use as default where no field prefix is given in the query string.

expand_wildcardsoneOf

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`.

frominteger (int32)

Starting offset.

Default 0

ignore_unavailableboolean

If `false`, the request returns an error if it targets a missing or closed index.

lenientboolean

If `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.

preferencestring

Specifies the node or shard the operation should be performed on. Random by default.

Default "random"

qstring

Query in the Lucene query string syntax.

refreshoneOf

If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes.

request_cacheboolean

If `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

routingoneOf

A custom value used to route operations to a specific shard.

scrollstring

Period to retain the search context for scrolling.

scroll_sizeinteger (int32)

Size of the scroll request that powers the operation.

Default 100

search_timeoutstring

Explicit timeout for each search request. Defaults to no timeout.

search_typeoneOf

The type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`.

sizeinteger (int32)

Deprecated, use `max_docs` instead.

slicesoneOf

The 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.

timeoutstring

Period each deletion request waits for active shards.

versionboolean

If `true`, returns the document version as part of a hit.

wait_for_active_shardsoneOf

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`).

wait_for_completionboolean

If `true`, the request blocks until the operation is complete.

Default true

prettyboolean

Whether to pretty-format the returned JSON response.

Default false

humanboolean

Whether to return human-readable values for statistics.

Default false

error_traceboolean

Whether to include the stack trace of returned errors.

Default false

sourcestring

The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

filter_pathoneOf

A 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.

Delete by query — OpenSearch — Documentation