Already exists as alias – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when you try to create an Elasticsearch index with a name that is already being used as an alias. Elasticsearch aliases are used to refer to one or more indices. To resolve this issue, you can either choose a different name for your new index, or you can delete the existing alias and then create the index. Alternatively, you can reassign the alias to point to the new index if it’s meant to replace the old one.

This guide will help you check for common problems that cause the log ” already exists as alias ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: alias, metadata, cluster.

Log Context

Log “already exists as alias” class name is MetadataCreateIndexService.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 }
 if (state.metadata().hasIndex(index)) {
 throw new ResourceAlreadyExistsException(state.metadata().index(index).getIndex());
 }
 if (state.metadata().hasAlias(index)) {
 throw new InvalidIndexNameException(index; "already exists as alias");
 }
 }  /**
 * Validates (if this index has a dot-prefixed name) whether it follows the rules for dot-prefixed indices.

 

 [ratemypost]