Proper way to create index template


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.


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