# Curl command to set the number of replicas

**URL:** https://discuss.elastic.co/t/curl-command-to-set-the-number-of-replicas/76962
**Category:** Elasticsearch
**Created:** [March 1, 2017, 10:18am UTC](https://discuss.elastic.co/t/curl-command-to-set-the-number-of-replicas/76962 "2017-03-01T10:18:17Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Prateek\_Kshtriya](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@Prateek\_Kshtriya](https://discuss.elastic.co/u/Prateek_Kshtriya)
#### Post date: [March 1, 2017, 10:18am UTC](https://discuss.elastic.co/t/curl-command-to-set-the-number-of-replicas/76962/1 "2017-03-01T10:18:17Z")

</div>

Hi All ,

Please help me with the CURL command to change the "number\_of\_replicas" on Elasticsearch 5.0, the below command is not currently working with same-  
curl -XPUT [http://localhost:9200/\_settings](http://localhost:9200/_settings) -d {"number\_of\_replicas":0}

Please suggest if anything missing .

Regards,  
Prateek Divya

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [March 1, 2017, 10:33am UTC](https://discuss.elastic.co/t/curl-command-to-set-the-number-of-replicas/76962/2 "2017-03-01T10:33:22Z")

</div>

You need to do that per index: [https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-update-settings.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-update-settings.html)

```auto
curl -XPUT 'localhost:9200/my_index/_settings' -d '{
    "index.number_of_replicas" : 0
}'

```

---

<div class="post-metadata">

### Author: ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)
#### Post date: [March 1, 2017, 11:34am UTC](https://discuss.elastic.co/t/curl-command-to-set-the-number-of-replicas/76962/3 "2017-03-01T11:34:08Z")

</div>

It is also possible to create a top-level template that would apply to all newly-created indices.

---

<div class="post-metadata">

### Author: ![Prateek\_Kshtriya](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@Prateek\_Kshtriya](https://discuss.elastic.co/u/Prateek_Kshtriya)
#### Post date: [March 3, 2017, 1:57pm UTC](https://discuss.elastic.co/t/curl-command-to-set-the-number-of-replicas/76962/4 "2017-03-03T13:57:53Z")

</div>

I tried the same but getting error as "Could not resolve host : 0"

ELK is on windows machine so if that could impact anywhere.

---

<div class="post-metadata">

### Author: ![Prateek\_Kshtriya](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@Prateek\_Kshtriya](https://discuss.elastic.co/u/Prateek_Kshtriya)
#### Post date: [March 3, 2017, 1:59pm UTC](https://discuss.elastic.co/t/curl-command-to-set-the-number-of-replicas/76962/5 "2017-03-03T13:59:06Z")

</div>

> [@jasontedor](#):
>
> It is also possible to create a top-level template that would apply to all newly-created indices.

Please suggest how to create a top-level template. I have not done earlier so have no context around same.

---

<div class="post-metadata">

### Author: ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)
#### Post date: [March 3, 2017, 11:21pm UTC](https://discuss.elastic.co/t/curl-command-to-set-the-number-of-replicas/76962/6 "2017-03-03T23:21:45Z")

</div>

You can do it like this:

```auto
PUT localhost:9200/_template/number_of_replicas
{
  "template": "*",
  "settings": {
    "number_of_replicas": 0
  }
}

```

See the [docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html) for more details.

---

<div class="post-metadata">

### Author: ![Prateek\_Kshtriya](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@Prateek\_Kshtriya](https://discuss.elastic.co/u/Prateek_Kshtriya)
#### Post date: [March 8, 2017, 1:10pm UTC](https://discuss.elastic.co/t/curl-command-to-set-the-number-of-replicas/76962/7 "2017-03-08T13:10:10Z")

</div>

> [@dadoonet](#):
>
> curl -XPUT 'localhost:9200/my\_index/\_settings' -d '{  
> "index.number\_of\_replicas" : 0  
> }'

Thanks David. It worked when tried the same on Kibana console not on explicit CURl command line

---

<div class="post-metadata">

### Author: ![Prateek\_Kshtriya](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@Prateek\_Kshtriya](https://discuss.elastic.co/u/Prateek_Kshtriya)
#### Post date: [March 8, 2017, 1:11pm UTC](https://discuss.elastic.co/t/curl-command-to-set-the-number-of-replicas/76962/8 "2017-03-08T13:11:33Z")

</div>

> [@jasontedor](#):
>
> See the docs for more details.

Thanks Jason. It helped with the same.

---

<div class="post-metadata">

### Author: ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)
#### Post date: [March 8, 2017, 2:02pm UTC](https://discuss.elastic.co/t/curl-command-to-set-the-number-of-replicas/76962/9 "2017-03-08T14:02:14Z")

</div>

You're very welcome.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 5, 2017, 2:02pm UTC](https://discuss.elastic.co/t/curl-command-to-set-the-number-of-replicas/76962/10 "2017-04-05T14:02:16Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
