Skip to content

[BUG] DataStreams: Can't delete index template that matches the data stream but is unused #20078

@jpmat296

Description

@jpmat296

Describe the bug

This issue is similar to #9194. But in #9194 the two index templates were not data streams templates (no "data_stream": {} for the first).

In this new issue, the two index templates are both for data streams.

Related component

Indexing

To Reproduce

PUT _index_template/test
{
  "index_patterns": [
    "test*"
  ],
  "data_stream": {},
  "template": {},
  "composed_of": [],
  "priority": 50
}

PUT _index_template/test-data-stream
{
  "index_patterns": [
    "test"
  ],
  "data_stream": {},
  "template": {},
  "composed_of": [],
  "priority": 51
}

PUT _data_stream/test

DELETE _index_template/test

Get following error at DELETE time:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "unable to remove composable templates [test] as they are in use by a data streams [test]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "unable to remove composable templates [test] as they are in use by a data streams [test]"
  },
  "status": 400
}

Expected behavior

It should be possible to delete the index template as it is not used.

Additional Details

Setup: Docker on macOS
Opensearch: v3.3.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    IndexingIndexing, Bulk Indexing and anything related to indexingbugSomething isn't workinguntriaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions