# No number-of-replicas/shards ... what then?

**URL:** https://discuss.elastic.co/t/no-number-of-replicas-shards-what-then/107386
**Category:** Elasticsearch
**Created:** [November 13, 2017, 12:11pm UTC](https://discuss.elastic.co/t/no-number-of-replicas-shards-what-then/107386 "2017-11-13T12:11:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![alexolivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexolivan/32/57425_2.png) [@alexolivan](https://discuss.elastic.co/u/alexolivan)
#### Post date: [November 13, 2017, 12:11pm UTC](https://discuss.elastic.co/t/no-number-of-replicas-shards-what-then/107386/1 "2017-11-13T12:11:35Z")

</div>

Hi again community!

I have just created a small cluster of VMs to keep with my experiments with new ELK5 and filebeat, and, to my surprise, I was unable to start EL until I removed shards/replica config from yml file...

By reading around, I readed that, those values have to be manually set per index.... and of course I can't believe this.  
There should be a way to configure the thing, or a way to automate this.  
If every day I get a new set of indexes, because logstash inserts data for services into indexes that do change their index name, every day, since it appends date at the end, there should be a way to control number of shards and replicas, otherwise, soon or later, indexes would start having default 1 replica unless we're manually intervening all the time... I'm sure I'm missing completelly the point, could you help me.

Thank you in advance.  
Best regards!

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [November 13, 2017, 12:15pm UTC](https://discuss.elastic.co/t/no-number-of-replicas-shards-what-then/107386/2 "2017-11-13T12:15:03Z")

</div>

This is typically managed through [index templates](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/indices-templates.html), so I would recommend you have a look at that.

---

<div class="post-metadata">

### Author: ![alexolivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexolivan/32/57425_2.png) [@alexolivan](https://discuss.elastic.co/u/alexolivan)
#### Post date: [November 13, 2017, 12:39pm UTC](https://discuss.elastic.co/t/no-number-of-replicas-shards-what-then/107386/3 "2017-11-13T12:39:23Z")

</div>

Hi! thank you for your help...

Ok... readed that... a little bit overwheelming, when considering how simple is what it was, but here we go:

Provide that I have a bunch of logstash-servicefoo-YYYY.MM.DD, logstash-servicebar-YYYY.MM.DD, as were the result of folowing the classic ELK howtos of my era (1.x).  
Provide that I don't care about aliasing, iteming or remaping and all that, but just want to have 2 replicas and lets say, 6 shards, for my minimal mockup cluster

Then I would need omething like that.... right?

curl -XPUT 'localhost:9200/\_template/logstash?pretty' -H 'Content-Type: application/json' -d'  
{  
"template" : "logstash-\*",  
"settings" : {  
"number\_of\_replicas" : 2,  
"number\_of\_shards" : 6  
}  
}  
'

I'm tryng to try it, but, pasting this into the console seems to not like the server 😛 probably there's a typo...

EDIT: worked as a one-liner...  
curl -XPUT '192.168.100.4:9200/\_template/logstash?pretty' -H 'Content-Type: application/json' -d'{ "template" : "logstash-\*", "settings" : { "number\_of\_replicas" : 2, "number\_of\_shards" : 6 } }'

which caused:  
{  
"acknowledged" : true  
}

Let's see what happens next!

EDIT: ouch! that screwed the default logstash template... I think I'm starting to get the point behind templates, and how it adds a whole new layer of possible configuration on incoming data... but I miss a litle bit of more classic control through config files, at least for defaults

---

<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: [December 11, 2017, 12:39pm UTC](https://discuss.elastic.co/t/no-number-of-replicas-shards-what-then/107386/4 "2017-12-11T12:39:26Z")

</div>

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