Once you have snapshots of your data, it can be restored. The restore process is very fast: the indexed shard data is simply copied on the nodes and activated.
You need an up-and-running Elasticsearch installation as we described in the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.
To execute curl
via the command line, you need to install curl
for your operative system.
To correctly execute the following command, the backup created in the previous recipe is required.
To restore a snapshot, we will perform the following steps:
snap_1
for the test
and test1
indices, the HTTP method is PUT
and the curl
command is:curl -XPOST "http://localhost:9200/_snapshot/my_repository/snap_1/_restore? pretty" -d '{ "indices": "test-index,test-2", "ignore_unavailable": "true", "include_global_state": false, "rename_pattern": "test-(.+)", "rename_replacement": "copy_$1" }'
The result will be:
{
"accepted" : true
}
red
to yellow
or green
.The restore process is very fast. The process comprises the following steps:
red
state).It's possible to control the restore process via some parameters, including:
indices
: This controls the indices that must be restored. If not defined, all indices in the snapshot are restored (a comma delimited list of indices; wildcards are accepted).ignore_unavailable
: This stops the restore from failing if some indices are missing (default false
).include_global_state
: This allows the restoration of the global state from the snapshot (defaults to true
, available values are true
/false
).rename_pattern
and rename_replacement
: The first one is a pattern that must be matched, and the second one uses regular expression replacement to define a new index name.partial
: If it set to true
, it is allows the restoration of indices with missing shards (default false
).3.137.164.24