Failed to create alias and index with pattern %s and alias %s – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 8.4-8.9

Briefly, this error occurs when Elasticsearch is unable to create an index and its corresponding alias due to a conflict, such as an existing index or alias with the same name, or due to insufficient permissions. To resolve this issue, you can check if an index or alias with the same name already exists and delete it if necessary. Alternatively, ensure that the user has the necessary permissions to create indices and aliases. Also, check the index naming conventions and patterns to ensure they are valid and do not contain any illegal characters.

This guide will help you check for common problems that cause the log ” Failed to create alias and index with pattern [%s] and alias [%s] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin, index, alias.

Log Context

Log “Failed to create alias and index with pattern [%s] and alias [%s]” classname is MlIndexAndAlias.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

        TimeValue masterNodeTimeout;
        ActionListener finalListener
    ) {

        final ActionListener loggingListener = ActionListener.wrap(finalListener::onResponse; e -> {
            logger.error(() -> format("Failed to create alias and index with pattern [%s] and alias [%s]"; indexPatternPrefix; alias); e);
            finalListener.onFailure(e);
        });

        // If both the index and alias were successfully created then wait for the shards of the index that the alias points to be ready
        ActionListener indexCreatedListener = ActionListener.wrap(created -> {

 

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?