# Proper way to create index template

**URL:** https://discuss.elastic.co/t/proper-way-to-create-index-template/147805
**Category:** Elasticsearch
**Created:** [September 8, 2018, 10:31am UTC](https://discuss.elastic.co/t/proper-way-to-create-index-template/147805 "2018-09-08T10:31:55Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mladen](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@mladen](https://discuss.elastic.co/u/mladen)
#### Post date: [September 8, 2018, 10:31am UTC](https://discuss.elastic.co/t/proper-way-to-create-index-template/147805/1 "2018-09-08T10:31:55Z")

</div>

Hi,

I need to create custom index templates for my indices. For now I just want to set number of shards. So my question is it OK to define just number of shards for example:

```
PUT _template/iibraz_qmraz2
{
  "index_patterns": ["iibraz_qmraz2-*"],
  "settings": {
    "number_of_shards": 3
  }
}

```

and let elasticsearch do the dynamic mapping for fields?

Or I can ingest data and let elasticsearch do dynamic mapping and then use:

`GET /_template/iibraz_qmraz2`

to create index template from result?

I am aware that best practice is to create mappings for all field manually but i don't have knowledge for that right now.

BR,  
Mladen

---

<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: [October 6, 2018, 10:34am UTC](https://discuss.elastic.co/t/proper-way-to-create-index-template/147805/2 "2018-10-06T10:34:48Z")

</div>

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