Issue with templates for system indices

We have recently upgraded to 1.12 and are having an issue with .opendistro-ism-managed-index-history indices including a few other system ones. We are unable to change the replicas. We were using the old template system which was working fine up until the upgrade (were on 1.8). As this broke we tried using the new template system however this does not work either. Here is the new template we created;

{
  "index_patterns": [
    ".opendistro-ism-managed-index-history-*"
  ],
  "template": {
    "settings": {
      "number_of_shards": 1,
      "number_of_replicas": 0,
      "index": {
        "opendistro.index_state_management.policy_id": "30days-delete"
      }
    }
  },
  "priority": 500,
  "version": 2,
  "_meta": {
    "description": "Fix the replica issue"
  }
}

This is happening on all our clusters. I was looking at Redirectingā€¦ that says this is the correct method (It also needs correcting as it is missing the ā€œtemplateā€ : {} part)
I have used the index_template simulator and that shows the result we want, however this is not what is happening.

Thanks,

Tony.

FYI on the documentation issue:

Same issue here. Tried Fix but system Index is always with 1 Replica. Upgraded to 1.13.1 but didnt fix.
@tony
Did this fix work for you?
Thats my config

GET /_index_template/ism_history_indices

{
    "index_templates": [
        {
            "name": "ism_history_indices",
            "index_template": {
                "index_patterns": [
                    ".opendistro-ism-managed-index-history-*"
                ],
                "template": {
                    "settings": {
                        "index": {
                            "number_of_shards": "1",
                            "number_of_replicas": "0"
                        }
                    }
                },
                "composed_of": []
            }
        }
    ]
}

This is my index template I am using for all opendistro internal indexes for one node cluster (v1.11.0):
curl -ivvk -H "Content-Type: application/json" -H "Accept: application/json" -u admin:admin -X PUT "https://localhost:9200/_template/efk_all" -d '{"index_patterns":["kibana_*",".opendistro-job-scheduler-*",".kibana_*","security-auditlog-*",".opendistro-ism-*"],"settings":{"number_of_shards":1,"number_of_replicas":0,"opendistro.index_state_management.policy_id":"delete_7days_old_no_replicas","index.mapping.total_fields.limit":1500}}'

Hi @fabide we canā€™t upgrade our estate yet to the newest version so we are currently running a cron job against all clusters that changes the replicas.

@mmamaenko are you deleting off your kibana index after 7 days?

no. it is just example

1 Like

Unfortunately the template settings are not being used while history index is created as it is created with replicas and shards set based on the cluster settings - index-management/IndexManagementIndices.kt at main Ā· opensearch-project/index-management Ā· GitHub

one can set these cluster settings however to achieve the desired history index settings
set the shards: ā€œopendistro.index_state_management.history.number_of_shardsā€
set the replicas: ā€œopendistro.index_state_management.history.number_of_replicasā€