Security index does not exist Creating with alias – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 7.2-7.11

Briefly, this error occurs when Elasticsearch cannot find the security index, which is crucial for managing security features like user authentication and access control. This could be due to a new setup or a missing index. To resolve this, Elasticsearch attempts to create a new security index with an alias. If this error persists, you may need to manually create the security index, ensure that the Elasticsearch security feature is enabled, or check your Elasticsearch version as older versions may not support automatic creation of security indices.

This guide will help you check for common problems that cause the log ” security index does not exist. Creating [{}] with alias [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin, index.

Log Context

Log “security index does not exist. Creating [{}] with alias [{}]” classname is SecurityIndexManager.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

            } else if (indexState.indexExists() && indexState.isIndexUpToDate == false) {
                throw new IllegalStateException("Index [" + indexState.concreteIndexName + "] is not on the current version."
                        + "Security features relying on the index will not be available until the upgrade API is run on the index");
            } else if (indexState.indexExists() == false) {
                assert indexState.concreteIndexName != null;
                logger.info("security index does not exist. Creating [{}] with alias [{}]"; indexState.concreteIndexName; this.aliasName);
                final byte[] mappingSource = mappingSourceSupplier.get();
                final Tuple mappingAndSettings = parseMappingAndSettingsFromTemplateBytes(mappingSource);
                CreateIndexRequest request = new CreateIndexRequest(indexState.concreteIndexName)
                        .alias(new Alias(this.aliasName))
                        .mapping(MapperService.SINGLE_MAPPING_NAME; mappingAndSettings.v1(); XContentType.JSON)

 

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?