Convert curl examples to Sense for snapshot restore

Closes #11537

Conflicts:
	docs/reference/modules/snapshots.asciidoc
This commit is contained in:
Clinton Gormley 2015-06-19 18:04:52 +02:00
parent 11330d1a34
commit e8d5b8ce4b
1 changed files with 80 additions and 52 deletions

View File

@ -13,28 +13,33 @@ Elasticsearch. The repository settings are repository-type specific. See below f
[source,js]
-----------------------------------
$ curl -XPUT 'http://localhost:9200/_snapshot/my_backup' -d '{
"type": "REPOSITORY TYPE",
"settings": {
PUT /_snapshot/my_backup
{
"type": "fs",
"settings": {
... repository specific settings ...
}
}'
}
}
-----------------------------------
Once a repository is registered, its information can be obtained using the following command:
[source,js]
-----------------------------------
$ curl -XGET 'http://localhost:9200/_snapshot/my_backup?pretty'
GET /_snapshot/my_backup
-----------------------------------
// AUTOSENSE
which returns:
[source,js]
-----------------------------------
{
"my_backup" : {
"type" : "fs",
"settings" : {
"compress" : "true",
"location" : "/mount/backups/my_backup"
"my_backup": {
"type": "fs",
"settings": {
"compress": "true",
"location": "/mount/backups/my_backup"
}
}
}
@ -45,14 +50,14 @@ all repositories currently registered in the cluster:
[source,js]
-----------------------------------
$ curl -XGET 'http://localhost:9200/_snapshot'
GET /_snapshot
-----------------------------------
or
[source,js]
-----------------------------------
$ curl -XGET 'http://localhost:9200/_snapshot/_all'
GET /_snapshot/_all
-----------------------------------
[float]
@ -136,21 +141,24 @@ verification when registering or updating a repository:
[source,js]
-----------------------------------
$ curl -XPUT 'http://localhost:9200/_snapshot/s3_repository?verify=false' -d '{
"type": "s3",
"settings": {
"bucket": "my_s3_bucket",
"region": "eu-west-1",
}
}'
PUT /_snapshot/s3_repository?verify=false
{
"type": "s3",
"settings": {
"bucket": "my_s3_bucket",
"region": "eu-west-1"
}
}
-----------------------------------
// AUTOSENSE
The verification process can also be executed manually by running the following command:
[source,js]
-----------------------------------
$ curl -XPOST 'http://localhost:9200/_snapshot/my_backup/_verify'
POST /_snapshot/my_backup/_verify
-----------------------------------
// AUTOSENSE
It returns a list of nodes where repository was successfully verified or an error message if verification process failed.
@ -163,8 +171,9 @@ command:
[source,js]
-----------------------------------
$ curl -XPUT "localhost:9200/_snapshot/my_backup/snapshot_1?wait_for_completion=true"
PUT /_snapshot/my_backup/snapshot_1?wait_for_completion=true
-----------------------------------
// AUTOSENSE
The `wait_for_completion` parameter specifies whether or not the request should return immediately after snapshot
initialization (default) or wait for snapshot completion. During snapshot initialization, information about all
@ -176,12 +185,14 @@ specifying the list of indices in the body of the snapshot request.
[source,js]
-----------------------------------
$ curl -XPUT "localhost:9200/_snapshot/my_backup/snapshot_1" -d '{
"indices": "index_1,index_2",
"ignore_unavailable": "true",
"include_global_state": false
}'
PUT /_snapshot/my_backup/snapshot_1
{
"indices": "index_1,index_2",
"ignore_unavailable": "true",
"include_global_state": false
}
-----------------------------------
// AUTOSENSE
The list of indices that should be included into the snapshot can be specified using the `indices` parameter that
supports <<search-multi-index-type,multi index syntax>>. The snapshot request also supports the
@ -215,15 +226,17 @@ Once a snapshot is created information about this snapshot can be obtained using
[source,shell]
-----------------------------------
$ curl -XGET "localhost:9200/_snapshot/my_backup/snapshot_1"
GET /_snapshot/my_backup/snapshot_1
-----------------------------------
// AUTOSENSE
All snapshots currently stored in the repository can be listed using the following command:
[source,shell]
-----------------------------------
$ curl -XGET "localhost:9200/_snapshot/my_backup/_all"
GET /_snapshot/my_backup/_all
-----------------------------------
// AUTOSENSE
coming[2.0] A currently running snapshot can be retrieved using the following command:
@ -236,8 +249,9 @@ A snapshot can be deleted from the repository using the following command:
[source,shell]
-----------------------------------
$ curl -XDELETE "localhost:9200/_snapshot/my_backup/snapshot_1"
DELETE /_snapshot/my_backup/snapshot_1
-----------------------------------
// AUTOSENSE
When a snapshot is deleted from a repository, Elasticsearch deletes all files that are associated with the deleted
snapshot and not used by any other snapshots. If the deleted snapshot operation is executed while the snapshot is being
@ -249,8 +263,9 @@ A repository can be deleted using the following command:
[source,shell]
-----------------------------------
$ curl -XDELETE "localhost:9200/_snapshot/my_backup"
DELETE /_snapshot/my_backup
-----------------------------------
// AUTOSENSE
When a repository is deleted, Elasticsearch only removes the reference to the location where the repository is storing
the snapshots. The snapshots themselves are left untouched and in place.
@ -262,8 +277,9 @@ A snapshot can be restored using the following command:
[source,shell]
-----------------------------------
$ curl -XPOST "localhost:9200/_snapshot/my_backup/snapshot_1/_restore"
POST /_snapshot/my_backup/snapshot_1/_restore
-----------------------------------
// AUTOSENSE
By default, all indices in the snapshot as well as cluster state are restored. It's possible to select indices that
should be restored as well as prevent global cluster state from being restored by using `indices` and
@ -275,14 +291,16 @@ Set `include_aliases` to `false` to prevent aliases from being restored together
[source,js]
-----------------------------------
$ curl -XPOST "localhost:9200/_snapshot/my_backup/snapshot_1/_restore" -d '{
"indices": "index_1,index_2",
"ignore_unavailable": "true",
"include_global_state": false,
"rename_pattern": "index_(.+)",
"rename_replacement": "restored_index_$1"
}'
POST /_snapshot/my_backup/snapshot_1/_restore
{
"indices": "index_1,index_2",
"ignore_unavailable": "true",
"include_global_state": false,
"rename_pattern": "index_(.+)",
"rename_replacement": "restored_index_$1"
}
-----------------------------------
// AUTOSENSE
The restore operation can be performed on a functioning cluster. However, an existing index can be only restored if it's
<<indices-open-close,closed>> and has the same number of shards as the index in the snapshot.
@ -308,14 +326,18 @@ the index `index_1` without creating any replicas while switching back to defaul
[source,js]
-----------------------------------
$ curl -XPOST "localhost:9200/_snapshot/my_backup/snapshot_1/_restore" -d '{
"indices": "index_1",
"index_settings" : {
"index.number_of_replicas": 0
},
"ignore_index_settings": ["index.refresh_interval"]
}'
POST /_snapshot/my_backup/snapshot_1/_restore
{
"indices": "index_1",
"index_settings": {
"index.number_of_replicas": 0
},
"ignore_index_settings": [
"index.refresh_interval"
]
}
-----------------------------------
// AUTOSENSE
Please note, that some settings such as `index.number_of_shards` cannot be changed during restore operation.
@ -348,31 +370,35 @@ A list of currently running snapshots with their detailed status information can
[source,shell]
-----------------------------------
$ curl -XGET "localhost:9200/_snapshot/_status"
GET /_snapshot/_status
-----------------------------------
// AUTOSENSE
In this format, the command will return information about all currently running snapshots. By specifying a repository name, it's possible
to limit the results to a particular repository:
[source,shell]
-----------------------------------
$ curl -XGET "localhost:9200/_snapshot/my_backup/_status"
GET /_snapshot/my_backup/_status
-----------------------------------
// AUTOSENSE
If both repository name and snapshot id are specified, this command will return detailed status information for the given snapshot even
if it's not currently running:
[source,shell]
-----------------------------------
$ curl -XGET "localhost:9200/_snapshot/my_backup/snapshot_1/_status"
GET /_snapshot/my_backup/snapshot_1/_status
-----------------------------------
// AUTOSENSE
Multiple ids are also supported:
[source,shell]
-----------------------------------
$ curl -XGET "localhost:9200/_snapshot/my_backup/snapshot_1,snapshot_2/_status"
GET /_snapshot/my_backup/snapshot_1,snapshot_2/_status
-----------------------------------
// AUTOSENSE
[float]
=== Monitoring snapshot/restore progress
@ -385,8 +411,9 @@ The snapshot operation can be also monitored by periodic calls to the snapshot i
[source,shell]
-----------------------------------
$ curl -XGET "localhost:9200/_snapshot/my_backup/snapshot_1"
GET /_snapshot/my_backup/snapshot_1
-----------------------------------
// AUTOSENSE
Please note that snapshot info operation uses the same resources and thread pool as the snapshot operation. So,
executing a snapshot info operation while large shards are being snapshotted can cause the snapshot info operation to wait
@ -396,8 +423,9 @@ To get more immediate and complete information about snapshots the snapshot stat
[source,shell]
-----------------------------------
$ curl -XGET "localhost:9200/_snapshot/my_backup/snapshot_1/_status"
GET /_snapshot/my_backup/snapshot_1/_status
-----------------------------------
// AUTOSENSE
While snapshot info method returns only basic information about the snapshot in progress, the snapshot status returns
complete breakdown of the current state for each shard participating in the snapshot.