Book Image

ElasticSearch Cookbook

By : Alberto Paro
Book Image

ElasticSearch Cookbook

By: Alberto Paro

Overview of this book

Table of Contents (20 chapters)
ElasticSearch Cookbook Second Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

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" : "SUCCESS",
        "start_time" : "2014-11-13T21:40:45.406Z",
        "start_time_in_millis" : 1415914845406,
        "end_time" : "2014-11-13T21:40:46.692Z",
        "end_time_in_millis" : 1415914846692,
        "duration_in_millis" : 1286,
        "failures...