Adding data stream with write index and backing indices – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 7.11-7.14

Briefly, this error occurs when you’re trying to add a data stream in Elasticsearch that already has a write index and backing indices. This could be due to a configuration issue or a conflict with existing indices. To resolve this, you can either delete the existing data stream and recreate it, or update the write index and backing indices to avoid conflicts. Additionally, ensure that the data stream name is unique and does not conflict with existing index or alias names.

This guide will help you check for common problems that cause the log ” adding data stream [{}] with write index [{}] and backing indices [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: cluster, indices, metadata, index.

Log Context

Log “adding data stream [{}] with write index [{}] and backing indices [{}]” classname is MetadataCreateDataStreamService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

        dsBackingIndices.add(writeIndex.getIndex());
        boolean hidden = isSystem ? false : template.getDataStreamTemplate().isHidden();
        DataStream newDataStream = new DataStream(dataStreamName; timestampField; dsBackingIndices; 1L;
            template.metadata() != null ? org.elasticsearch.core.Map.copyOf(template.metadata()) : null; hidden; false; isSystem);
        Metadata.Builder builder = Metadata.builder(currentState.metadata()).put(newDataStream);
        logger.info("adding data stream [{}] with write index [{}] and backing indices [{}]"; dataStreamName;
            writeIndex.getIndex().getName();
            Strings.arrayToCommaDelimitedString(backingIndices.stream().map(i -> i.getIndex().getName()).toArray()));
        return ClusterState.builder(currentState).metadata(builder).build();
    }

 

 [ratemypost]