Dangling index exists on local file system but not in cluster metadata – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-7.8

Briefly, this error occurs when Elasticsearch finds indices on the local file system that are not registered in the cluster metadata. This can happen due to abrupt shutdowns or disk failures. To resolve this, you can manually import the dangling index using the Import Dangling Index API. Alternatively, you can enable the automatic import of dangling indices by setting the ‘gateway.auto_import_dangling_indices’ to true. However, be cautious as this could lead to data duplication if the index exists elsewhere in the cluster.

This guide will help you check for common problems that cause the log ” [{}] dangling index exists on local file system; but not in cluster metadata; ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index, cluster, dangling.

Log Context

Log “[{}] dangling index exists on local file system; but not in cluster metadata; ” classname is DanglingIndicesState.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                } else if (graveyard.containsIndex(indexMetadata.getIndex())) {
                    logger.warn("[{}] can not be imported as a dangling index; as an index with the same name and UUID exist in the " +
                                "index tombstones.  This situation is likely caused by copying over the data directory for an index " +
                                "that was previously deleted."; indexMetadata.getIndex());
                } else {
                    logger.info("[{}] dangling index exists on local file system; but not in cluster metadata; " +
                                "auto import to cluster state"; indexMetadata.getIndex());
                    newIndices.put(indexMetadata.getIndex(); stripAliases(indexMetadata));
                }
            }
            return newIndices;

 

 [ratemypost]