Upgrading index template for from version to version – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 7.7-7.8

Briefly, this error occurs when there is an attempt to upgrade an Elasticsearch index template from one version to another. This could be due to a version mismatch between the current Elasticsearch version and the version the index template was created with. To resolve this issue, you can either update your Elasticsearch to the required version or recreate the index template with the current Elasticsearch version. Additionally, ensure that the index template is compatible with the new version before upgrading.

This guide will help you check for common problems that cause the log ” upgrading index template [{}] for [{}] from version [{}] to version [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index, version, template, plugin.

Log Context

Log “upgrading index template [{}] for [{}] from version [{}] to version [{}]” classname is IndexTemplateRegistry.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                    logger.info("adding index template [{}] for [{}]; because it doesn't exist"; templateName; getOrigin());
                    putTemplate(newTemplate; creationCheck);
                } else if (Objects.isNull(currentTemplate.getVersion()) || newTemplate.getVersion() > currentTemplate.getVersion()) {
                    // IndexTemplateConfig now enforces templates contain a `version` property; so if the template doesn't have one we can
                    // safely assume it's an old version of the template.
                    logger.info("upgrading index template [{}] for [{}] from version [{}] to version [{}]";
                        templateName; getOrigin(); currentTemplate.getVersion(); newTemplate.getVersion());
                    putTemplate(newTemplate; creationCheck);
                } else {
                    logger.trace("not adding index template [{}] for [{}]; because it already exists at version [{}]";