Briefly, this error occurs when you try to assign the same alias to more than one index in Elasticsearch. Aliases in Elasticsearch are unique identifiers used to refer to one or more indices. The error indicates that you’re trying to create an alias that already exists. To resolve this issue, you can either remove the existing alias before assigning it to a new index, or use a different, unique alias for your new index. Another solution is to use alias actions (add or remove) to reassign the alias to the new index.
This guide will help you check for common problems that cause the log ” Duplicate alias {} ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: parser, plugin, alias.
Log Context
Log “Duplicate alias {}” class name is LogicalPlanBuilder.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :
// unwrap query (and validate while at it) MapcteRelations = Maps.newLinkedHashMapWithExpectedSize(namedQueries.size()); for (SubQueryAlias namedQuery : namedQueries) { if (cteRelations.put(namedQuery.alias(); namedQuery) != null) { throw new ParsingException(namedQuery.source(); "Duplicate alias {}"; namedQuery.alias()); } } // return WITH return new With(source(ctx); body; cteRelations);