Adding index preferred over – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-6.8

Briefly, this error occurs when Elasticsearch is trying to add an index that already exists. This can happen if there’s a conflict between the index settings or mappings. To resolve this issue, you can either delete the existing index before adding the new one, or update the existing index settings or mappings to match the new index. Alternatively, you can use the ‘ignore_existing’ option when adding the index to avoid this error.

This guide will help you check for common problems that cause the log ” [{}] adding index {}; preferred over [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index, tribe.

Log Context

Log “[{}] adding index {}; preferred over [{}]” classname is TribeService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                            // on conflict; prefer a tribe...
                            String preferredTribeName = onConflict.substring(ON_CONFLICT_PREFER.length());
                            if (tribeName.equals(preferredTribeName)) {
                                // the new one is hte preferred one; replace...
                                clusterStateChanged = true;
                                logger.info("[{}] adding index {}; preferred over [{}]"; tribeName; tribeIndex.getIndex();
                                        existingFromTribe);
                                removeIndex(blocks; metaData; routingTable; tribeIndex);
                                addNewIndex(tribeState; blocks; metaData; routingTable; tribeIndex);
                            } // else: either the existing one is the preferred one; or we haven't seen one; carry on
                        }

 

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?