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

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

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

Create 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 for the snapshot.
  </definition>
  <definition term="--snapshot string required">
    The name of the snapshot.
    It supportes date math.
    It must be unique in the repository.
  </definition>
  <definition term="--master-timeout string">
    The period to wait for a connection to the master node.
    If no response is received before the timeout expires, the request fails and returns an error.
  </definition>
  <definition term="--wait-for-completion">
    If `true`, the request returns a response when the snapshot is complete.
    If `false`, the request returns a response when the snapshot initializes.
  </definition>
  <definition term="--expand-wildcards enum">
    Determines how wildcard patterns in the `indices` parameter match data streams and indices.
    It supports comma-separated values such as `open,hidden`.
    **Values:** all, open, closed, hidden, none
    **Repeatable:** pass `--expand-wildcards` multiple times to supply more than one value
  </definition>
  <definition term="--feature-states string[]">
    The feature states to include in the snapshot.
    Each feature state includes one or more system indices containing related data.
    You can view a list of eligible features using the get features API. If `include_global_state` is `true`, all current feature states are included by default.
    If `include_global_state` is `false`, no feature states are included by default. Note that specifying an empty array will result in the default behavior.
    To exclude all feature states, regardless of the `include_global_state` value, specify an array with only the value `none` (`["none"]`).
    **Repeatable:** pass `--feature-states` multiple times to supply more than one value
  </definition>
  <definition term="--ignore-unavailable">
    If `true`, the request ignores data streams and indices in `indices` that are missing or closed.
    If `false`, the request returns an error for any data stream or index that is missing or closed.
  </definition>
  <definition term="--include-global-state">
    If `true`, the current cluster state is included in the snapshot.
    The cluster state includes persistent cluster settings, composable index templates, legacy index templates, ingest pipelines, and ILM policies.
    It also includes data stored in system indices, such as Watches and task records (configurable via `feature_states`).
  </definition>
  <definition term="--indices string">
    A comma-separated list of data streams and indices to include in the snapshot.
    It supports a multi-target syntax.
    The default is an empty array (`[]`), which includes all regular data streams and regular indices.
    To exclude all data streams and indices, use `-*`. You can't use this parameter to include or exclude system indices or system data streams from a snapshot.
    Use `feature_states` instead.
    **Repeatable:** pass `--indices` multiple times to supply more than one value
  </definition>
  <definition term="--metadata string">
    Arbitrary metadata to the snapshot, such as a record of who took the snapshot, why it was taken, or any other useful data.
    It can have any contents but it must be less than 1024 bytes.
    This information is not automatically generated by Elasticsearch.
  </definition>
  <definition term="--partial">
    If `true`, allows the snapshot to proceed even if some of the target shards are unavailable.
    In this case, the resulting snapshot will not contain snapshots of the unavailable target shards, and will report its state as `PARTIAL`.
    Additionally, if `true`, allows index metadata operations such as deletions while the snapshot is in progress.
    This is almost always preferable to failing the snapshot completely when a single shard is unavailable, and blocking index metadata operations. If `false`, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available, and index metadata operations such as deletions will be forbidden until the snapshot completes.
  </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>