Recovering index failed – recovering as closed – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-6.8

Briefly, this error occurs when Elasticsearch tries to recover an index that is closed. This could be due to a misconfiguration or a failed operation. To resolve this issue, you can try reopening the index using the ‘open index’ API. If the problem persists, check the Elasticsearch logs for more detailed error messages. It might be necessary to delete and recreate the index, but ensure you have a backup before doing so. Also, verify your cluster health and ensure there are no network issues causing the recovery failure.

This guide will help you check for common problems that cause the log ” recovering index {} failed – recovering as closed ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index.

Log Context

Log “recovering index {} failed – recovering as closed” classname is Gateway.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                            // verify that we can actually create this index - if not we recover it as closed with lots of warn logs
                            indicesService.verifyIndexMetadata(electedIndexMetaData; electedIndexMetaData);
                        }
                    } catch (Exception e) {
                        final Index electedIndex = electedIndexMetaData.getIndex();
                        logger.warn(() -> new ParameterizedMessage("recovering index {} failed - recovering as closed"; electedIndex); e);
                        electedIndexMetaData = IndexMetaData.builder(electedIndexMetaData).state(IndexMetaData.State.CLOSE).build();
                    }

                    metaDataBuilder.put(electedIndexMetaData; false);
                }

 

 [ratemypost]