# Multiple index parameters per index type

**URL:** <https://discuss.elastic.co/t/multiple-index-parameters-per-index-type/43328>\
**Category:** Elasticsearch\
**Created:** [March 3, 2016, 1:11am UTC](https://discuss.elastic.co/t/multiple-index-parameters-per-index-type/43328 "2016-03-03T01:11:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)\
**Post date:** [March 3, 2016, 1:11am UTC](https://discuss.elastic.co/t/multiple-index-parameters-per-index-type/43328/1 "2016-03-03T01:11:21Z")

</div>

I have multiple type of index files generated by different data sources. They all reside on the same cluster.

index-typeA  
index-typeB  
index-typeC

each one has different shard count, replica count requirements.

is there a way in my elasticsearch.yaml to specify

index.number\_of\_shards  
index.number\_of\_replicas

parameters for each specific index? Or this pertains to the cluster itself?

I understand that you can do this by API for each index, but wont' this be considered as transient setting and will be reset in case full cluster restart?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 3, 2016, 7:19am UTC](https://discuss.elastic.co/t/multiple-index-parameters-per-index-type/43328/2 "2016-03-03T07:19:46Z")

</div>

Anything in `elasticsearch.yml` applies to the cluster. If you want to apply different ones to different indices then you should use a template 🙂

> [@stecino](#):
>
> I understand that you can do this by API for each index, but wont' this be considered as transient setting and will be reset in case full cluster restart?

Only for replicas can you do this dynamically. You can specify number of shards only when you create the index.

---

<div class="post-metadata">

**Author:** ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)\
**Post date:** [March 4, 2016, 7:44pm UTC](https://discuss.elastic.co/t/multiple-index-parameters-per-index-type/43328/3 "2016-03-04T19:44:59Z")

</div>

Ok so at the moment I have my index mappings generated dynamically. If I use JSON over http, something like:

curl -XPUT '[http://localhost:9200/lwes-mm-dd-yyyy/](http://localhost:9200/lwes-mm-dd-yyyy/)' -d '  
index :  
number\_of\_shards : 5  
number\_of\_replicas : 1  
'

is there a way to generate the date dynamically ?  
Also do I need to tie to something like a crontab to execute in daily basis?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 4, 2016, 9:04pm UTC](https://discuss.elastic.co/t/multiple-index-parameters-per-index-type/43328/4 "2016-03-04T21:04:34Z")

</div>

Look into templates instead, they're much better.

---

<div class="post-metadata">

**Author:** ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)\
**Post date:** [March 4, 2016, 11:36pm UTC](https://discuss.elastic.co/t/multiple-index-parameters-per-index-type/43328/5 "2016-03-04T23:36:13Z")

</div>

I want to, but I guess I am not understanding how the template is being executed by the elasticsearch. In my case when I have rolling log, how do I tell elastic search to run a specific template everyday.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 5, 2016, 12:10am UTC](https://discuss.elastic.co/t/multiple-index-parameters-per-index-type/43328/6 "2016-03-05T00:10:12Z")

</div>

When you create the template you define a pattern that it should match, so when an index is created it looks for templates that match and then applies them.

---

<div class="post-metadata">

**Author:** ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)\
**Post date:** [March 5, 2016, 1:28am UTC](https://discuss.elastic.co/t/multiple-index-parameters-per-index-type/43328/7 "2016-03-05T01:28:27Z")

</div>

Ok I think I got the handle of it

curl -XGET "[http://localhost:9200/\_template/template\_lwes?pretty](http://localhost:9200/_template/template_lwes?pretty)"  
{  
"template\_lwes" : {  
"order" : 0,  
"template" : "lwes-\*",  
"settings" : {  
"index" : {  
"number\_of\_shards" : "5",  
"number\_of\_replicas" : "1"  
}  
},  
"mappings" : { },  
"aliases" : { }  
}  
}

I was able to apply the template. So if I didn't assign any mappings, I am assuming that dynamic ones will be applied, correct?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 5, 2016, 9:01pm UTC](https://discuss.elastic.co/t/multiple-index-parameters-per-index-type/43328/8 "2016-03-05T21:01:19Z")

</div>

That is correct.

---

<div class="post-metadata">

**Author:** ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)\
**Post date:** [March 8, 2016, 1:42am UTC](https://discuss.elastic.co/t/multiple-index-parameters-per-index-type/43328/9 "2016-03-08T01:42:49Z")

</div>

Thanks for the help

---

<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:** [July 5, 2017, 11:10pm UTC](https://discuss.elastic.co/t/multiple-index-parameters-per-index-type/43328/10 "2017-07-05T23:10:31Z")

</div>


