Skip to content

Instantly share code, notes, and snippets.

@duboisph
Last active March 1, 2018 08:38
Show Gist options
  • Save duboisph/e150d3bd7b424d1ddb07fc9ebed26efa to your computer and use it in GitHub Desktop.
Save duboisph/e150d3bd7b424d1ddb07fc9ebed26efa to your computer and use it in GitHub Desktop.
Reconfigure single node Elasticsearch replicas
#!/bin/bash
ES=$1
curl -s -XPUT ${ES}/_template/default -H 'Content-Type: application/json' -d '{ "order": 0, "template": "*", "settings": { "number_of_replicas": 0 }}'
echo
IFS=$'\n'
for line in $(curl -s ${ES}/_cat/indices?v 2> /dev/null); do
INDEX=$(echo $line | (awk '{print $3;}'))
curl -s -XPUT ${ES}/${INDEX}/_settings -H 'Content-Type: application/json' -d '{ "index" : { "number_of_replicas" : 0 } }'
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment