{"record":{"id":"906ebd3debd0cdaa","repo":"elastic/elasticsearch","slug":"invalid-data-stream-name-must-follow-naming","errorCode":null,"errorMessage":"invalid data stream name: [{}]; must follow naming scheme <type>-<dataset>-<namespace>","messagePattern":"invalid data stream name: \\[(.+?)\\]; must follow naming scheme <type>-<dataset>-<namespace>","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/RerouteProcessor.java","lineNumber":89,"sourceCode":"        }\n        this.destination = destination;\n    }\n\n    @Override\n    public IngestDocument execute(IngestDocument ingestDocument) throws Exception {\n        if (destination != null) {\n            ingestDocument.reroute(destination);\n            return ingestDocument;\n        }\n        final String indexName = ingestDocument.getFieldValue(IngestDocument.Metadata.INDEX.getFieldName(), String.class);\n        final String currentType;\n        final String currentDataset;\n        final String currentNamespace;\n\n        // parse out the <type>-<dataset>-<namespace> components from _index\n        int indexOfFirstDash = indexName.indexOf('-');\n        if (indexOfFirstDash < 0) {\n            throw new IllegalArgumentException(format(NAMING_SCHEME_ERROR_MESSAGE, indexName));\n        }\n        int indexOfSecondDash = indexName.indexOf('-', indexOfFirstDash + 1);\n        if (indexOfSecondDash < 0) {\n            throw new IllegalArgumentException(format(NAMING_SCHEME_ERROR_MESSAGE, indexName));\n        }\n        currentType = parseDataStreamType(indexName, indexOfFirstDash);\n        currentDataset = parseDataStreamDataset(indexName, indexOfFirstDash, indexOfSecondDash);\n        currentNamespace = parseDataStreamNamespace(indexName, indexOfSecondDash);\n\n        String type = determineDataStreamField(ingestDocument, this.type, currentType);\n        String dataset = determineDataStreamField(ingestDocument, this.dataset, currentDataset);\n        String namespace = determineDataStreamField(ingestDocument, this.namespace, currentNamespace);\n        String newTarget = type + \"-\" + dataset + \"-\" + namespace;\n        ingestDocument.reroute(newTarget);\n        setFieldValue(ingestDocument, DATA_STREAM_TYPE, type);\n        setFieldValue(ingestDocument, DATA_STREAM_DATASET, dataset);\n        setFieldValue(ingestDocument, DATA_STREAM_NAMESPACE, namespace);\n        if (ingestDocument.getCtxMap().containsKey(EVENT_DATASET) || ingestDocument.hasField(EVENT_DATASET)) {","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/RerouteProcessor.java#L71-L107","documentation":"Thrown by RerouteProcessor.execute when the current _index value contains no dash at all, so it cannot be parsed as a <type>-<dataset>-<namespace> data stream name. The processor requires at least two dashes to split the three components.","triggerScenarios":"Running the reroute processor (without an explicit destination) on a document whose _index metadata is a plain index name with no dashes, e.g. 'myindex'. indexOfFirstDash returns -1 and the exception fires.","commonSituations":"Pointing the reroute processor at documents indexed into a regular index rather than a data stream. Using reroute without a destination on non-data-stream indices. Misconfigured pipelines migrated from a data-stream context to a regular index.","solutions":["Provide an explicit destination in the processor config so it skips data-stream-name parsing.","Ensure the document is actually part of a data stream before using reroute without a destination.","Switch to a data stream naming convention (<type>-<dataset>-<namespace>) for the target index."],"exampleFix":"// before\n{\n  \"reroute\": { }\n}\n// after (explicit destination avoids parsing)\n{\n  \"reroute\": { \"destination\": \"logs-myapp-prod\" }\n}","handlingStrategy":"validation","validationCode":"// Validate _index has at least two dashes before reroute without destination\nString idx = document.getFieldValue(\"_index\", String.class);\nif (idx == null || idx.indexOf('-') < 0) {\n    // set an explicit destination or route to a data stream\n}","typeGuard":"boolean looksLikeDataStreamName(String idx) {\n    if (idx == null) return false;\n    int first = idx.indexOf('-');\n    return first > 0 && idx.indexOf('-', first + 1) > first;\n}","tryCatchPattern":"try {\n    // run reroute without destination\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"invalid data stream name\")) {\n        // provide a destination or ensure _index is a data stream name\n    } else { throw e; }\n}","preventionTips":["Always provide a destination when rerouting from non-data-stream indices.","Confirm the document belongs to a data stream before using reroute without a destination.","Validate _index format matches <type>-<dataset>-<namespace> in a pre-check."],"tags":["elasticsearch","ingest-pipeline","reroute","data-stream","validation"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}