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

Opster Team

Aug-23, Version: 7.9-7.15

Briefly, this error occurs when Elasticsearch is trying to upgrade an older version of an index template to a newer version. This could be due to a version mismatch between the Elasticsearch cluster and the index template. To resolve this issue, you can either update your index template to match the version of your Elasticsearch cluster or downgrade your Elasticsearch cluster to match the version of your index template. Alternatively, you can delete the old index template and create a new one that is compatible with your current Elasticsearch version.

This guide will help you check for common problems that cause the log ” upgrading legacy 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: template, plugin, version.

Log Context

Log “upgrading legacy 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 legacy template [{}] for [{}]; because it doesn't exist"; templateName; getOrigin());
                    putLegacyTemplate(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 legacy template [{}] for [{}] from version [{}] to version [{}]";
                        templateName; getOrigin(); currentTemplate.getVersion(); newTemplate.getVersion());
                    putLegacyTemplate(newTemplate; creationCheck);
                } else {
                    logger.trace("not adding legacy template [{}] for [{}]; because it already exists at version [{}]";


How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?