Get the search shards

  • POST also GET /{index}/_search_shards
  • POST also GET /_search_shards
Auth

Get the indices and shards that a search request would be run against. This information can be useful for working out issues or planning optimizations with routing and shard preferences. When filtered aliases are used, the filter is returned as part of the indices section.

If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias.

Required authorization

Index privileges view_index_metadata

Path parameters

index union string | string[] optional

A comma-separated list of data streams, indices, and aliases to search. It supports wildcards (*). To search all data streams and indices, omit this parameter or use * or _all.

Leave it out to use /_search_shards.

Query parameters

allow_no_indices boolean · default: false

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.

expand_wildcards union oneOf · default: open

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.

Supported values include:

  • all: Match any data stream or index, including hidden ones.
  • open: Match open, non-hidden indices. Also matches any non-hidden data stream.
  • closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.
  • hidden: Match hidden data streams and hidden indices. Must be combined with open, closed, or both.
  • none: Wildcard expressions are not accepted.
Values: all open closed hidden none
ignore_unavailable boolean · default: false

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

local boolean · default: false

If true, the request retrieves information from the local node only.

master_timeout string · default: 30s

The period to wait for a connection to the master node. If the master node is not available before the timeout expires, the request fails and returns an error. IT can also be set to -1 to indicate that the request should never timeout.

preference string

The node or shard the operation should be performed on. It is random by default.

routing string

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

Response

application/json
nodes map string to object required
<string> object
name string required

The human-readable identifier of the node.

ephemeral_id string required

The ephemeral ID of the node.

transport_address string required

The host and port where transport HTTP connections are accepted.

external_id string required
attributes map string to string required

Lists node attributes.

roles enum[] required
Values: master data data_cold data_content data_frozen data_hot data_warm client ingest ml voting_only transform remote_cluster_client coordinating_only
version string required
min_index_version number required
max_index_version number required
shards object[] required
indices map string to object required
<string> object
aliases string[]
filter {} Query