count

edit
client.count({
  index: string | string[],
  type: string | string[],
  ignore_unavailable: boolean,
  allow_no_indices: boolean,
  expand_wildcards: 'open' | 'closed' | 'none' | 'all',
  min_score: number,
  preference: string,
  routing: string | string[],
  q: string,
  analyzer: string,
  analyze_wildcard: boolean,
  default_operator: 'AND' | 'OR',
  df: string,
  lenient: boolean,
  terminate_after: number,
  body: object
})

Reference

index

string | string[] - A comma-separated list of indices to restrict the results

type

string | string[] - A comma-separated list of types to restrict the results

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)

expand_wildcards or expandWildcards

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

min_score or minScore

number - Include only documents with a specific _score value in the result

preference

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

routing

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

q

string - Query in the Lucene query string syntax

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

lenient

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

terminate_after or terminateAfter

number - The maximum count for each shard, upon reaching which the query execution will terminate early

body

object - A query to restrict the results specified with the Query DSL (optional)