Executing a snapshot

In the previous recipe, we defined a repository. Now you can create snapshots of indices. For every repository, it's possible to define multiple snapshots.

Getting ready

You need a working ElasticSearch cluster and the repository created in the previous recipe.

How to do it...

To manage a snapshot, we will perform the following:

  • To create a snapshot called snap_1 for the indices test and test1, the HTTP method is PUT and the curl command is:
    curl -XPUT "localhost:9200/_snapshot/my_backup/snap_1?wait_for_completion=true" -d '{
      "indices": " test-index,test-2",
      "ignore_unavailable": "true",
      "include_global_state": false
    }'
    

    The result will be as follows:

    { "snapshot" : { "snapshot" : "snap_1", "indices" : [ "test-index" ], "state" ...

Get ElasticSearch Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.