Skip to content

Instantly share code, notes, and snippets.

@portante
Last active April 5, 2018 11:03
Show Gist options
  • Save portante/fc2f81a6e0a56db545cbdf1aa5f73c3b to your computer and use it in GitHub Desktop.
Save portante/fc2f81a6e0a56db545cbdf1aa5f73c3b to your computer and use it in GitHub Desktop.
A simple script to set the replica count for all indices to 1.
#!/bin/bash
ES_URL='https://localhost:9200'
curl_put='curl -s -X PUT --cacert /etc/elasticsearch/secret/admin-ca --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key'
$curl_put $ES_URL/${1}/_settings?pretty -d '{ "index" : { "auto_expand_replicas" : "false" } }'
$curl_put $ES_URL/${1}/_settings?pretty -d '{ "index" : { "number_of_replicas" : 1 } }'
@portante
Copy link
Author

portante commented Apr 5, 2018

$ ./change-replica-count-1.sh .searchguard.\*

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