Skip to content

Instantly share code, notes, and snippets.

@portante
Last active May 18, 2018 12:24
Show Gist options
  • Select an option

  • Save portante/516de6542a8a99432fb62c578d320030 to your computer and use it in GitHub Desktop.

Select an option

Save portante/516de6542a8a99432fb62c578d320030 to your computer and use it in GitHub Desktop.
A simple script to set the replica count of all indices to 0
#!/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" : 0 } }'
@portante
Copy link
Copy Markdown
Author

portante commented Oct 2, 2017

Note that the Elasticsearch cluster will go yellow until the replica shards are created and sync'd.

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