Get the search shards

POST /{index}/_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

  • index string | array[string] Required

    Returns the indices and shards that a search request would be executed against.

Query parameters

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

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

  • local boolean

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

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

Responses

POST /{index}/_search_shards
curl \
 -X POST http://api.example.com/{index}/_search_shards
Response examples (200)
{
  "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": {}
    }
  }
}