Get the search shards
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.
Path parameters
-
Returns the indices and shards that a search request would be executed against.
Query parameters
-
allow_no_indices boolean
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 targetingfoo*,bar*
returns an error if an index starts withfoo
but no index starts withbar
. -
expand_wildcards string | array[string]
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
. -
local boolean
If
true
, the request retrieves information from the local node only. -
preference string
Specifies the node or shard the operation should be performed on. Random by default.
-
routing string
Custom value used to route operations to a specific shard.
curl \
-X POST http://api.example.com/{index}/_search_shards
{
"nodes": {
"additionalProperty1": {
"name": "string",
"ephemeral_id": "string",
"transport_address": "string",
"external_id": "string",
"attributes": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"roles": [
"master"
],
"version": "string",
"min_index_version": 42.0,
"max_index_version": 42.0
},
"additionalProperty2": {
"name": "string",
"ephemeral_id": "string",
"transport_address": "string",
"external_id": "string",
"attributes": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"roles": [
"master"
],
"version": "string",
"min_index_version": 42.0,
"max_index_version": 42.0
}
},
"shards": [
[
{
"state": "UNASSIGNED",
"primary": true,
"node": "string",
"shard": 42.0,
"index": "string",
"allocation_id": {
"*": "string"
},
"recovery_source": {
"*": "string"
},
"unassigned_info": {
"": "string",
"last_allocation_status": "string",
"reason": "INDEX_CREATED",
"details": "string",
"failed_allocation_attempts": 42.0,
"delayed": true,
"allocation_status": "string"
},
"relocating_node": "string",
"relocation_failure_info": {
"failed_attempts": 42.0
}
}
]
],
"indices": {
"additionalProperty1": {
"aliases": [
"string"
],
"filter": {}
},
"additionalProperty2": {
"aliases": [
"string"
],
"filter": {}
}
}
}