Index Mapping v/s Template

Can someone explain the major points of difference between Index Mapping and Template, since many examples described were not clear enough, Can someone explain difference with an example?

Hi @Prabhav

Index -Template

As the name says this is template which an index can take. you can predefine all settings like

  • primary shards
  • number of replicas
  • ...

And you can also define a index-mapping inside a template. (i will get to it below)

Then you also can add a patterns of indices name where theese templates should be activated. So example index-pattern in index-templates says test-*. So each index with names like test-1, test-abc etc will take the settings

Index-Mapping

Think about a document. This is a json file which lands inside an index. And a json file has attribute and values. And know for analysing elasticsearch needs to know wihch attribute contains what type of value(is it a text, or a keyword or a timestamp). So this can be defined in an index-mapping.

Conclusion: index mapping contains information about what kind of values is inside an index. An Index-template contains predefines index options(settings, mappings, analyzer) which will get adapted to an index on creation.

Helped?

4 Likes

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