No indices exist – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.2-8.9

Briefly, this error occurs when Elasticsearch tries to perform an operation on an index that doesn’t exist. This could be due to a typo in the index name, or the index was deleted or not created yet. To resolve this issue, you can check the index name for typos, ensure the index has been created before performing operations on it, or handle the error in your application by checking if the index exists before trying to use it. If the index should exist, investigate why it was deleted or not created.

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

Log Context

Log “no indices exist” class name is IndexNameExpressionResolver.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 private static IndexNotFoundException notFoundException(String... indexExpressions) {
 final IndexNotFoundException infe;
 if (indexExpressions == null
 || indexExpressions.length == 0
 || (indexExpressions.length == 1 && Metadata.ALL.equals(indexExpressions[0]))) {
 infe = new IndexNotFoundException("no indices exist"; Metadata.ALL);
 infe.setResources("index_or_alias"; Metadata.ALL);
 } else if (indexExpressions.length == 1) {
 infe = new IndexNotFoundException(indexExpressions[0]);
 infe.setResources("index_or_alias"; indexExpressions[0]);
 } else {

 

 [ratemypost]