Jordi
Jordi

Reputation: 23247

ElasticSearch: _template vs _index_template

I've just realized that ES has a _/_template and a _/_index_template.

What are they for?

I was using code:

PutIndexTemplateRequest ngramTemplate = new PutIndexTemplateRequest("ngram-template")
    .patterns(Arrays.asList("resourcetable-*", "termconcept-*"))
    .settings(Settings.builder().put("index.max_ngram_diff", 50));

I didn't understand why my ngram-template didn't appear on _/_index_template.

After that, I was looking on _/_template.....

Which is the difference between them?

Upvotes: 3

Views: 819

Answers (1)

hamid bayat
hamid bayat

Reputation: 2179

Elasticsearch switched from _template to _index_template in version 7.8.

_template is deprecated in 7.8 but still usable. if an indices match both lagacy template (_template) and Composable template (_index_template), elasticsearch will use Composable template.

the main difference betwean legacy and composable template is that legacy template is static and if you want change a field in all templates you must edit all templates but new _index_template is modular and for changing a setting in all templates you only need to change one component.

Upvotes: 6

Related Questions