Skip to content

Instantly share code, notes, and snippets.

@elipapa
Created September 11, 2017 11:02
Show Gist options
  • Save elipapa/a35ff84b6835d595f1c8cde917103d72 to your computer and use it in GitHub Desktop.
Save elipapa/a35ff84b6835d595f1c8cde917103d72 to your computer and use it in GitHub Desktop.
restore open targets elasticsearch public snapshots
#!/usr/bin/env bash
# assuming your ES is at http://localhost:9200
# set all existing indices to 0 replicas
curl -XPUT "http://localhost:9200/_settings" --data '{"index":{"number_of_replicas": 0}}'
# set marvel index to default 0 replicas
curl -XPUT "http://localhost:9200/_template/custom_marvel" --data '{
"template": ".marvel*",
"order": 1,
"settings": {"number_of_replicas": 0}
}'
# Registering the S3 release repository ...
curl -XPUT "http://localhost:9200/_snapshot/17.06" --data '{
"type": "url",
"settings": {
"url": "https://s3-eu-west-1.amazonaws.com/targetvalidation-releases-es-snapshots/17.06/"
}}'
# triggering the restore of the snapshot...
curl -XPOST "http://localhost:9200/_snapshot/17.06/release/_restore" -d '{
"ignore_unavailable": "true",
"index_settings": {"index.number_of_replicas": 0},
"include_global_state": "false"
}'
@elipapa
Copy link
Author

elipapa commented Sep 11, 2017

note that the elasticsearch.yml config file for your Elasticsearch deployment must have the line:

repositories.url.allowed_urls: ["https://s3-eu-west-1.amazonaws.com/*"]

for this to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment