deleteByQuery

edit
client.deleteByQuery({
  index: string | string[],
  type: string | string[],
  analyzer: string,
  analyze_wildcard: boolean,
  default_operator: 'AND' | 'OR',
  df: string,
  from: number,
  ignore_unavailable: boolean,
  allow_no_indices: boolean,
  conflicts: 'abort' | 'proceed',
  expand_wildcards: 'open' | 'closed' | 'none' | 'all',
  lenient: boolean,
  preference: string,
  q: string,
  routing: string | string[],
  scroll: string,
  search_type: 'query_then_fetch' | 'dfs_query_then_fetch',
  search_timeout: string,
  size: number,
  sort: string | string[],
  _source: string | string[],
  _source_excludes: string | string[],
  _source_includes: string | string[],
  terminate_after: number,
  stats: string | string[],
  version: boolean,
  request_cache: boolean,
  refresh: boolean,
  timeout: string,
  wait_for_active_shards: string,
  scroll_size: number,
  wait_for_completion: boolean,
  requests_per_second: number,
  slices: number,
  body: object
})

Reference

index

string | string[] - A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices

type

string | string[] - A comma-separated list of document types to search; leave empty to perform the operation on all types

analyzer

string - The analyzer to use for the query string

analyze_wildcard or analyzeWildcard

boolean - Specify whether wildcard and prefix queries should be analyzed (default: false)

default_operator or defaultOperator

'AND' | 'OR' - The default operator for query string query (AND or OR)
Default: OR

df

string - The field to use as default where no field prefix is given in the query string

from

number - Starting offset (default: 0)

ignore_unavailable or ignoreUnavailable

boolean - Whether specified concrete indices should be ignored when unavailable (missing or closed)

allow_no_indices or allowNoIndices

boolean - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)

conflicts

'abort' | 'proceed' - What to do when the delete by query hits version conflicts?
Default: abort

expand_wildcards or expandWildcards

'open' | 'closed' | 'none' | 'all' - Whether to expand wildcard expression to concrete indices that are open, closed or both.
Default: open

lenient

boolean - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored

preference

string - Specify the node or shard the operation should be performed on (default: random)

q

string - Query in the Lucene query string syntax

routing

string | string[] - A comma-separated list of specific routing values

scroll

string - Specify how long a consistent view of the index should be maintained for scrolled search

search_type or searchType

'query_then_fetch' | 'dfs_query_then_fetch' - Search operation type

search_timeout or searchTimeout

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

size

number - Number of hits to return (default: 10)

sort

string | string[] - A comma-separated list of <field>:<direction> pairs

_source

string | string[] - True or false to return the _source field or not, or a list of fields to return

_source_excludes or _sourceExcludes

string | string[] - A list of fields to exclude from the returned _source field

_source_includes or _sourceIncludes

string | string[] - A list of fields to extract and return from the _source field

terminate_after or terminateAfter

number - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.

stats

string | string[] - Specific tag of the request for logging and statistical purposes

version

boolean - Specify whether to return document version as part of a hit

request_cache or requestCache

boolean - Specify if request cache should be used for this request or not, defaults to index level setting

refresh

boolean - Should the effected indexes be refreshed?

timeout

string - Time each individual bulk request should wait for shards that are unavailable.
Default: 1m

wait_for_active_shards or waitForActiveShards

string - Sets the number of shard copies that must be active before proceeding with the delete by query 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)

scroll_size or scrollSize

number - Size on the scroll request powering the delete by query

wait_for_completion or waitForCompletion

boolean - Should the request should block until the delete by query is complete.
Default: true

requests_per_second or requestsPerSecond

number - The throttle for this request in sub-requests per second. -1 means no throttle.

slices

number - The number of slices this task should be divided into. Defaults to 1 meaning the task isn’t sliced into subtasks.
Default: 1

body

object - The search definition using the Query DSL