Removing component template – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 7.7-8.9

Briefly, this error occurs when Elasticsearch attempts to remove a component template that doesn’t exist or is currently in use by an index template. To resolve this issue, ensure the component template you’re trying to remove is not being used by any index templates. If it is, you’ll need to update or delete the index templates first. Alternatively, if the component template doesn’t exist, check for spelling errors or incorrect naming in your removal command.

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

Log Context

Log “removing component template [{}]” classname is MetadataIndexTemplateService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                throw new ResourceNotFoundException(names[0]);
            }
        }
        Metadata.Builder metadata = Metadata.builder(currentState.metadata());
        for (String templateName : templateNames) {
            logger.info("removing component template [{}]"; templateName);
            metadata.removeComponentTemplate(templateName);
        }
        return ClusterState.builder(currentState).metadata(metadata).build();
    }

 

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?