﻿---
title: stack es snapshot restore cli command
description: Restore a snapshot. Behaviour flags: --dry-run — validate all inputs and exit without performing any action 
url: https://www.elastic.co/elastic/docs-builder/docs/4075/reference/elastic-cli/cli/stack/es/snapshot/restore
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview
---

# stack es snapshot restore cli command
<cli-modifiers>
</cli-modifiers>

```bash
elastic stack es snapshot restore \
  --repository <repository> \
  --snapshot <snapshot> \
  [options]
```

Restore a snapshot.
**Behaviour flags:**
`--dry-run` — validate all inputs and exit without performing any action

## Options

<definitions>
  <definition term="--repository string required">
    The name of the repository to restore a snapshot from.
  </definition>
  <definition term="--snapshot string required">
    The name of the snapshot to restore.
  </definition>
  <definition term="--master-timeout string">
    The period to wait for the master node.
    If the master node is not available before the timeout expires, the request fails and returns an error.
    To indicate that the request should never timeout, set it to `-1`.
  </definition>
  <definition term="--wait-for-completion">
    If `true`, the request returns a response when the restore operation completes.
    The operation is complete when it finishes all attempts to recover primary shards for restored indices.
    This applies even if one or more of the recovery attempts fail. If `false`, the request returns a response when the restore operation initializes.
  </definition>
  <definition term="--feature-states string[]">
    The feature states to restore.
    If `include_global_state` is `true`, the request restores all feature states in the snapshot by default.
    If `include_global_state` is `false`, the request restores no feature states by default.
    Note that specifying an empty array will result in the default behavior.
    To restore no feature states, regardless of the `include_global_state` value, specify an array containing only the value `none` (`["none"]`).
    **Repeatable:** pass `--feature-states` multiple times to supply more than one value
  </definition>
  <definition term="--ignore-index-settings string[]">
    The index settings to not restore from the snapshot.
    You can't use this option to ignore `index.number_of_shards`. For data streams, this option applies only to restored backing indices.
    New backing indices are configured using the data stream's matching index template.
    **Repeatable:** pass `--ignore-index-settings` multiple times to supply more than one value
  </definition>
  <definition term="--ignore-unavailable">
    If `true`, the request ignores any index or data stream in indices that's missing from the snapshot.
    If `false`, the request returns an error for any missing index or data stream.
  </definition>
  <definition term="--include-aliases">
    If `true`, the request restores aliases for any restored data streams and indices.
    If `false`, the request doesn’t restore aliases.
  </definition>
  <definition term="--include-global-state">
    If `true`, restore the cluster state. The cluster state includes: * Persistent cluster settings
    - Index templates
    - Legacy index templates
    - Ingest pipelines
    - Index lifecycle management (ILM) policies
    - Stored scripts
    - For snapshots taken after 7.12.0, feature states If `include_global_state` is `true`, the restore operation merges the legacy index templates in your cluster with the templates contained in the snapshot, replacing any existing ones whose name matches one in the snapshot.
      It completely removes all persistent settings, non-legacy index templates, ingest pipelines, and ILM lifecycle policies that exist in your cluster and replaces them with the corresponding items from the snapshot. Use the `feature_states` parameter to configure how feature states are restored. If `include_global_state` is `true` and a snapshot was created without a global state then the restore request will fail.
  </definition>
  <definition term="--index-settings string">
    Index settings to add or change in restored indices, including backing indices.
    You can't use this option to change `index.number_of_shards`. For data streams, this option applies only to restored backing indices.
    New backing indices are configured using the data stream's matching index template.
  </definition>
  <definition term="--indices string">
    A comma-separated list of indices and data streams to restore.
    It supports a multi-target syntax.
    The default behavior is all regular indices and regular data streams in the snapshot. You can't use this parameter to restore system indices or system data streams.
    Use `feature_states` instead.
    **Repeatable:** pass `--indices` multiple times to supply more than one value
  </definition>
  <definition term="--partial">
    If `false`, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available. If true, it allows restoring a partial snapshot of indices with unavailable shards.
    Only shards that were successfully included in the snapshot will be restored.
    All missing shards will be recreated as empty.
  </definition>
  <definition term="--rename-pattern string">
    A rename pattern to apply to restored data streams and indices.
    Data streams and indices matching the rename pattern will be renamed according to `rename_replacement`. The rename pattern is applied as defined by the regular expression that supports referencing the original text, according to the `appendReplacement` logic.
  </definition>
  <definition term="--rename-replacement string">
    The rename replacement string that is used with the `rename_pattern`.
  </definition>
  <definition term="--error-trace">
    When set to `true` Elasticsearch will include the full stack trace of errors
    when they occur.
  </definition>
  <definition term="--filter-path string">
    Comma-separated list of filters in dot notation which reduce the response
    returned by Elasticsearch.
    **Repeatable:** pass `--filter-path` multiple times to supply more than one value
  </definition>
  <definition term="--human">
    When set to `true` will return statistics in a format suitable for humans.
    For example `"exists_time": "1h"` for humans and
    `"exists_time_in_millis": 3600000` for computers. When disabled the human
    readable values will be omitted. This makes sense for responses being consumed
    only by machines.
  </definition>
  <definition term="--pretty">
    If set to `true` the returned JSON will be "pretty-formatted". Only use
    this option for debugging only.
  </definition>
  <definition term="--input-file string">
    path to a JSON file to use as command input
  </definition>
  <definition term="--dry-run">
    validate all inputs and exit without performing any action (preview changes without applying them)
  </definition>
</definitions>


## Global Options

<definitions>
  <definition term="--json">
    output as JSON
  </definition>
</definitions>