Opensearch index template override priority

OS 2.11

Index templates - OpenSearch documentation stats that i can override a parts of a template if i index match with a higher priority template. This does not appear to work for me as the higher priority always takes preference and i lose my settings from the lower priority template.

example:

PUT index_template/test
{
“index_patterns”: ["test
*"],
“priority”: 50,
“template”: {
“settings”:{
“number_of_shards”: 8,
“number_of_replicas”: 1,
“plugins”: {
“index_state_management.rollover_alias”: “test_new”
},
“index”: {
“codec”: “best_compression”,
“unassigned.node_left.delayed_timeout”: “360m”,
“routing”: {
“allocation”: {
“require”: {
“temp”: “hot”
}
}
}
}
}
}
}

PUT index_template/test2
{
“priority”: 70,
“index_patterns”: ["test
*"],
“template”: {
“aliases” : {
“test_core” : {}
}
}
}

Can anyone help me find the cause?

Hi @coredump17,

It is correct “If the index name matches more than one template, OpenSearch takes the mappings and settings from the template with the highest priority and applies it to the index.”

Are you trying to use composed_of:

  "composed_of": [
    "component_template_1",
    "component_template_2"
  ],

Best,
mj

Hi myj,

Index templates - OpenSearch Documentation seems to suggest the templates would be merged. Use ‘test’ as a base and the override / set any settings in ‘test2’ as it has a higher priority.

Essentially, i with to use the same base template but change the alias to say, test_core_1 test_access_1.

Hi @coredump17,

What it suggests is that you can use the existing template as a base for the new template (with desired changes) and set a higher(est) priority, “OpenSearch takes the mappings and settings from the template with the highest priority” (If the index name matches more than one template (no merge)).

best,
mj

Thanks mantas. Clearly I missed that understand:)