[[snapshot]]
== snapshot

[float]
Summary
~~~~~~~

This command allows you to capture snapshots of indices into a pre-existing
repository. To create a repository you can
{ref}/modules-snapshots.html#_repositories[use the API], or the `es_repo_mgr`
script. There are other tools available.

Snapshots are incremental. Snapshotting to a named snapshot is also possible,
otherwise the default snapshot name will be the snapshot prefix + a timestamp:
`curator-%Y%m%d%H%M%S` (or YearMonthDayHourMinuteSecond). The default snapshot
prefix is `curator-`, but that can be overridden with the `--prefix` flag. With
incremental snapshotting, only new data (segments) will be backed up.

[float]
Flags
~~~~~

------------------------------------------------------------------------------
$ curator snapshot --help
Usage: curator snapshot [OPTIONS] COMMAND [ARGS]...

  Take snapshots of indices (Backup)

Options:
  --repository TEXT               Repository name.
  --name TEXT                     Override default name.
  --prefix TEXT                   Override default prefix.
  --wait_for_completion BOOLEAN   Wait for snapshot to complete before
                                  returning.  [default: True]
  --ignore_unavailable            Ignore unavailable shards/indices.
  --include_global_state BOOLEAN  Store cluster global state with snapshot.
                                  [default: True]
  --partial                       Do not fail if primary shard is unavailable.
  --request_timeout INTEGER       Allow this many seconds before the
                                  transaction times out.  [default: 21600]
  --skip-repo-validation          Skip repository access validation.
  --help                          Show this message and exit.

Commands:
  indices  Index selection.
------------------------------------------------------------------------------

&nbsp;

IMPORTANT: This command requires the <<indices-subcommand,indices>>
<<subcommand,subcommand>> for <<index-selection,index selection>>.

[float]
Examples
~~~~~~~~

Snapshot indices matching the selection parameters to the named repository:

-----------------------------------------------------------------------------------
curator snapshot --repository REPOSITORY_NAME indices <<index selection paramters>>
-----------------------------------------------------------------------------------

&nbsp;

[float]
Regarding timeouts
^^^^^^^^^^^^^^^^^^

A default of 6 hours (21600 seconds) will be applied for the
`--request_timeout`. Since a snapshot can take a long time, curator may
disconnect and fail to continue with further operations if the timeout is not
set high enough. This number may need to be higher, or could be reduced
depending on your scenario. The log file timestamps will indicate how long it
took to perform previous operations, which you could use as a guideline.

[float]
Regarding repositories
^^^^^^^^^^^^^^^^^^^^^^

Curator itself is completely repository agnostic. If you've created a repository
in any way, curator can make use of it. However, it must be noted that the S3
repository type cannot be used without having the
https://github.com/elasticsearch/elasticsearch-cloud-aws#s3-repository[AWS Cloud
Plugin for Elasticsearch] installed on each master and data node in your
cluster. The `es_repo_mgr` script can assist in creation of an S3 repository,
but creation of the repository will fail without this plugin being installed
first.
