Skip to content

[Index Management] Fix @custom component template creation#237952

Merged
kapral18 merged 3 commits intoelastic:mainfrom
kapral18:fix/index-management/fix-custom-component-template-create
Oct 10, 2025
Merged

[Index Management] Fix @custom component template creation#237952
kapral18 merged 3 commits intoelastic:mainfrom
kapral18:fix/index-management/fix-custom-component-template-create

Conversation

@kapral18
Copy link
Contributor

@kapral18 kapral18 commented Oct 8, 2025

Addresses #237916.

  • Fix /component_templates/{name}/datastreams route to return empty when the component template is not referenced by any index template, preventing unintended apply-mappings and the rollover modal for brand-new @custom component templates
  • add test coverage for component_templates routes folder
  • refactor testing setup

Manual test setup

  1. Run latest es/kibana locally from kibana repo source
  2. In DevTools:
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "text" },
        "timestamp": { "type": "date" }
      }
    }
  }
}

PUT _data_stream/foo-ds-1

# Introduce a conflict mapping in index-template
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "boolean" },
        "timestamp": { "type": "date" }
      }
    }
  }
}
  1. Go to /app/management/data/index_management/component_templates
  2. Create a new template that is not referenced by any index_template and has a @custom suffix, ex. random-1234@custom
  3. Verify the behavior: Before this PR change a modal asking to rollover conflicting data-stream foo-ds-1 will appear, and after this PR no modal will appear.

!Important Do not click apply now and rollover in the modal as it will mess up setup to verify before/after fix.

Release note

  • Fixed a bug in component template creation flow where a new component template with @custom suffix in name would lead to updating mappings of all unrelated data-streams and a popup would appear asking to rollover conflicting ones.
@kapral18 kapral18 requested a review from a team as a code owner October 8, 2025 01:14
@kapral18 kapral18 force-pushed the fix/index-management/fix-custom-component-template-create branch 2 times, most recently from c869ae4 to cfeb7e7 Compare October 8, 2025 09:48
@kapral18 kapral18 added release_note:fix Feature:Index Management Index and index templates UI Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// backport:version Backport to applied version labels labels Oct 8, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-management (Team:Kibana Management)

@kapral18 kapral18 force-pushed the fix/index-management/fix-custom-component-template-create branch 5 times, most recently from 48cadf3 to 60d1015 Compare October 8, 2025 13:23
@ElenaStoeva ElenaStoeva self-requested a review October 8, 2025 15:51
@ElenaStoeva
Copy link
Contributor

Hi @kapral18, I tested locally and I don't see the modal. However, I also don't see it without the changes from this PR so I might be doing something wrong - let's meet tomorrow and discuss this.

@ElenaStoeva
Copy link
Contributor

As per our offline discussion, we found that the issue with the modal is not reproducible in main, and we also couldn't verify the modal is still working correctly in main, so we need to get some more context on this functionality before merging the fix.

@kapral18
Copy link
Contributor Author

kapral18 commented Oct 9, 2025

@ElenaStoeva the problem in the end wasn't the issue itself not reproducing on main but rather me not providing a good repro instruction. I found a better more stably repro instruction that works everywhere. I updated the description of the PR with the instruction. It's also simpler. Let me know. Thanks and apologies for confusion

Copy link
Contributor

@ElenaStoeva ElenaStoeva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the instructions! Tested locally and verified that:

  • The modal is not displayed when the component template is not referenced by a conflicting index template
  • The modal is not displayed when the component is referenced by a non-conflicting index template
  • The modal is correctly displayed when the component template is referenced by a conflicting index template

Code changes also lgtm. Thanks for adding tests!

I'm approving to unblock the PR, but I wonder if we should test this behavior somehow in a follow-up, maybe with functional tests. Wdyt?

@kapral18 kapral18 force-pushed the fix/index-management/fix-custom-component-template-create branch from bf0c885 to 9282f3c Compare October 9, 2025 20:59
@kapral18 kapral18 enabled auto-merge (squash) October 9, 2025 21:01
@kapral18 kapral18 force-pushed the fix/index-management/fix-custom-component-template-create branch from e7b2ed9 to 9f52716 Compare October 10, 2025 10:30
Addresses elastic#237916.

- Fix `/component_templates/{name}/datastreams` route to return empty
when the component template is not referenced by any index template,
preventing unintended apply-mappings and the rollover modal for
brand-new `@custom` component templates
- add test coverage for `component_templates` routes folder
- refactor testing setup
- Renamed the `useDatastreamsRollover` hook to `useUpdateAssociatedDatastreamsMappings`.
- The corresponding test file and modal component have also been renamed to reflect this change.
- The functionality previously described as "rolling over linked datastreams" is now referred to as "updating mappings from template for associated data streams."
- The `showDatastreamRolloverModal` function is now `updateAssociatedDatastreamsMappings`, and its description clarifies that a modal is prompted for rollover only if mapping updates fail due to incompatible changes.
@kapral18 kapral18 force-pushed the fix/index-management/fix-custom-component-template-create branch from 9f52716 to ccf807b Compare October 10, 2025 14:51
@kapral18 kapral18 merged commit bb5514b into elastic:main Oct 10, 2025
12 checks passed
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
indexManagement 691.8KB 691.8KB +27.0B

History

@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.18, 8.19, 9.1, 9.2

https://github.com/elastic/kibana/actions/runs/18413797934

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 10, 2025
…37952)

Addresses elastic#237916.

- Fix `/component_templates/{name}/datastreams` route to return empty
when the component template is not referenced by any index template,
preventing unintended apply-mappings and the rollover modal for
brand-new `@custom` component templates
- add test coverage for `component_templates` routes folder
- refactor testing setup

## Manual test setup

1. Run latest es/kibana locally from kibana repo source
2. In DevTools:
```graphql
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "text" },
        "timestamp": { "type": "date" }
      }
    }
  }
}

PUT _data_stream/foo-ds-1

# Introduce a conflict mapping in index-template
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "boolean" },
        "timestamp": { "type": "date" }
      }
    }
  }
}
```
 4. Go to `/app/management/data/index_management/component_templates`
5. Create a new template that is not referenced by any `index_template`
and has a `@custom` suffix, ex. `random-1234@custom`
6. Verify the behavior: Before this PR change a modal asking to rollover
conflicting data-stream foo-ds-1 will appear, and after this PR no modal
will appear.

!Important Do not click `apply now and rollover` in the modal as it will
mess up setup to verify before/after fix.

## Release note

- Fixed a bug in component template creation flow where a new component
template with `@custom` suffix in name would lead to updating mappings
of all unrelated data-streams and a popup would appear asking to
rollover conflicting ones.

(cherry picked from commit bb5514b)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 10, 2025
…37952)

Addresses elastic#237916.

- Fix `/component_templates/{name}/datastreams` route to return empty
when the component template is not referenced by any index template,
preventing unintended apply-mappings and the rollover modal for
brand-new `@custom` component templates
- add test coverage for `component_templates` routes folder
- refactor testing setup

## Manual test setup

1. Run latest es/kibana locally from kibana repo source
2. In DevTools:
```graphql
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "text" },
        "timestamp": { "type": "date" }
      }
    }
  }
}

PUT _data_stream/foo-ds-1

# Introduce a conflict mapping in index-template
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "boolean" },
        "timestamp": { "type": "date" }
      }
    }
  }
}
```
 4. Go to `/app/management/data/index_management/component_templates`
5. Create a new template that is not referenced by any `index_template`
and has a `@custom` suffix, ex. `random-1234@custom`
6. Verify the behavior: Before this PR change a modal asking to rollover
conflicting data-stream foo-ds-1 will appear, and after this PR no modal
will appear.

!Important Do not click `apply now and rollover` in the modal as it will
mess up setup to verify before/after fix.

## Release note

- Fixed a bug in component template creation flow where a new component
template with `@custom` suffix in name would lead to updating mappings
of all unrelated data-streams and a popup would appear asking to
rollover conflicting ones.

(cherry picked from commit bb5514b)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.18
8.19 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.19:
- [Search][Accessibility] Show error text when fields are invalid (#238284)
- [Security Solution] Add FTR tests for prebuilt rules OOM testing (#236891)
9.1 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.1:
- [Search][Accessibility] Show error text when fields are invalid (#238284)
- [Security Solution] Add FTR tests for prebuilt rules OOM testing (#236891)
9.2

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 237952

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 10, 2025
…7952) (#238529)

# Backport

This will backport the following commits from `main` to `9.2`:
- [[Index Management] Fix @Custom component template creation
(#237952)](#237952)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2025-10-10T17:28:33Z","message":"[Index
Management] Fix @Custom component template creation
(#237952)\n\nAddresses #237916.\n\n- Fix
`/component_templates/{name}/datastreams` route to return empty\nwhen
the component template is not referenced by any index
template,\npreventing unintended apply-mappings and the rollover modal
for\nbrand-new `@custom` component templates\n- add test coverage for
`component_templates` routes folder\n- refactor testing setup\n\n##
Manual test setup\n\n1. Run latest es/kibana locally from kibana repo
source\n2. In DevTools:\n```graphql\nPUT
_index_template/foo-template\n{\n \"index_patterns\": [\"foo-ds-*\"],\n
\"data_stream\": {},\n \"template\": {\n \"mappings\": {\n
\"properties\": {\n \"message\": { \"type\": \"text\" },\n
\"timestamp\": { \"type\": \"date\" }\n }\n }\n }\n}\n\nPUT
_data_stream/foo-ds-1\n\n# Introduce a conflict mapping in
index-template\nPUT _index_template/foo-template\n{\n
\"index_patterns\": [\"foo-ds-*\"],\n \"data_stream\": {},\n
\"template\": {\n \"mappings\": {\n \"properties\": {\n \"message\": {
\"type\": \"boolean\" },\n \"timestamp\": { \"type\": \"date\" }\n }\n
}\n }\n}\n```\n 4. Go to
`/app/management/data/index_management/component_templates`\n5. Create a
new template that is not referenced by any `index_template`\nand has a
`@custom` suffix, ex. `random-1234@custom`\n6. Verify the behavior:
Before this PR change a modal asking to rollover\nconflicting
data-stream foo-ds-1 will appear, and after this PR no modal\nwill
appear.\n \n!Important Do not click `apply now and rollover` in the
modal as it will\nmess up setup to verify before/after fix.\n\n##
Release note\n\n- Fixed a bug in component template creation flow where
a new component\ntemplate with `@custom` suffix in name would lead to
updating mappings\nof all unrelated data-streams and a popup would
appear asking to\nrollover conflicting
ones.","sha":"bb5514b86ab5275346db2f82c41a0d7d83c85713","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Index
Management","Team:Kibana
Management","backport:version","v9.2.0","v9.3.0","v9.1.6","v8.18.9","v8.19.6"],"title":"[Index
Management] Fix @Custom component template
creation","number":237952,"url":"https://github.com/elastic/kibana/pull/237952","mergeCommit":{"message":"[Index
Management] Fix @Custom component template creation
(#237952)\n\nAddresses #237916.\n\n- Fix
`/component_templates/{name}/datastreams` route to return empty\nwhen
the component template is not referenced by any index
template,\npreventing unintended apply-mappings and the rollover modal
for\nbrand-new `@custom` component templates\n- add test coverage for
`component_templates` routes folder\n- refactor testing setup\n\n##
Manual test setup\n\n1. Run latest es/kibana locally from kibana repo
source\n2. In DevTools:\n```graphql\nPUT
_index_template/foo-template\n{\n \"index_patterns\": [\"foo-ds-*\"],\n
\"data_stream\": {},\n \"template\": {\n \"mappings\": {\n
\"properties\": {\n \"message\": { \"type\": \"text\" },\n
\"timestamp\": { \"type\": \"date\" }\n }\n }\n }\n}\n\nPUT
_data_stream/foo-ds-1\n\n# Introduce a conflict mapping in
index-template\nPUT _index_template/foo-template\n{\n
\"index_patterns\": [\"foo-ds-*\"],\n \"data_stream\": {},\n
\"template\": {\n \"mappings\": {\n \"properties\": {\n \"message\": {
\"type\": \"boolean\" },\n \"timestamp\": { \"type\": \"date\" }\n }\n
}\n }\n}\n```\n 4. Go to
`/app/management/data/index_management/component_templates`\n5. Create a
new template that is not referenced by any `index_template`\nand has a
`@custom` suffix, ex. `random-1234@custom`\n6. Verify the behavior:
Before this PR change a modal asking to rollover\nconflicting
data-stream foo-ds-1 will appear, and after this PR no modal\nwill
appear.\n \n!Important Do not click `apply now and rollover` in the
modal as it will\nmess up setup to verify before/after fix.\n\n##
Release note\n\n- Fixed a bug in component template creation flow where
a new component\ntemplate with `@custom` suffix in name would lead to
updating mappings\nof all unrelated data-streams and a popup would
appear asking to\nrollover conflicting
ones.","sha":"bb5514b86ab5275346db2f82c41a0d7d83c85713"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","9.1","8.18","8.19"],"targetPullRequestStates":[{"branch":"9.2","label":"v9.2.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/237952","number":237952,"mergeCommit":{"message":"[Index
Management] Fix @Custom component template creation
(#237952)\n\nAddresses #237916.\n\n- Fix
`/component_templates/{name}/datastreams` route to return empty\nwhen
the component template is not referenced by any index
template,\npreventing unintended apply-mappings and the rollover modal
for\nbrand-new `@custom` component templates\n- add test coverage for
`component_templates` routes folder\n- refactor testing setup\n\n##
Manual test setup\n\n1. Run latest es/kibana locally from kibana repo
source\n2. In DevTools:\n```graphql\nPUT
_index_template/foo-template\n{\n \"index_patterns\": [\"foo-ds-*\"],\n
\"data_stream\": {},\n \"template\": {\n \"mappings\": {\n
\"properties\": {\n \"message\": { \"type\": \"text\" },\n
\"timestamp\": { \"type\": \"date\" }\n }\n }\n }\n}\n\nPUT
_data_stream/foo-ds-1\n\n# Introduce a conflict mapping in
index-template\nPUT _index_template/foo-template\n{\n
\"index_patterns\": [\"foo-ds-*\"],\n \"data_stream\": {},\n
\"template\": {\n \"mappings\": {\n \"properties\": {\n \"message\": {
\"type\": \"boolean\" },\n \"timestamp\": { \"type\": \"date\" }\n }\n
}\n }\n}\n```\n 4. Go to
`/app/management/data/index_management/component_templates`\n5. Create a
new template that is not referenced by any `index_template`\nand has a
`@custom` suffix, ex. `random-1234@custom`\n6. Verify the behavior:
Before this PR change a modal asking to rollover\nconflicting
data-stream foo-ds-1 will appear, and after this PR no modal\nwill
appear.\n \n!Important Do not click `apply now and rollover` in the
modal as it will\nmess up setup to verify before/after fix.\n\n##
Release note\n\n- Fixed a bug in component template creation flow where
a new component\ntemplate with `@custom` suffix in name would lead to
updating mappings\nof all unrelated data-streams and a popup would
appear asking to\nrollover conflicting
ones.","sha":"bb5514b86ab5275346db2f82c41a0d7d83c85713"}},{"branch":"9.1","label":"v9.1.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
kapral18 added a commit to kapral18/kibana that referenced this pull request Oct 12, 2025
…37952)

Addresses elastic#237916.

- Fix `/component_templates/{name}/datastreams` route to return empty
when the component template is not referenced by any index template,
preventing unintended apply-mappings and the rollover modal for
brand-new `@custom` component templates
- add test coverage for `component_templates` routes folder
- refactor testing setup

1. Run latest es/kibana locally from kibana repo source
2. In DevTools:
```graphql
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "text" },
        "timestamp": { "type": "date" }
      }
    }
  }
}

PUT _data_stream/foo-ds-1

PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "boolean" },
        "timestamp": { "type": "date" }
      }
    }
  }
}
```
 4. Go to `/app/management/data/index_management/component_templates`
5. Create a new template that is not referenced by any `index_template`
and has a `@custom` suffix, ex. `random-1234@custom`
6. Verify the behavior: Before this PR change a modal asking to rollover
conflicting data-stream foo-ds-1 will appear, and after this PR no modal
will appear.

!Important Do not click `apply now and rollover` in the modal as it will
mess up setup to verify before/after fix.

- Fixed a bug in component template creation flow where a new component
template with `@custom` suffix in name would lead to updating mappings
of all unrelated data-streams and a popup would appear asking to
rollover conflicting ones.

(cherry picked from commit bb5514b)
@kapral18
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
9.1
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kapral18 added a commit to kapral18/kibana that referenced this pull request Oct 12, 2025
…37952)

Addresses elastic#237916.

- Fix `/component_templates/{name}/datastreams` route to return empty
when the component template is not referenced by any index template,
preventing unintended apply-mappings and the rollover modal for
brand-new `@custom` component templates
- add test coverage for `component_templates` routes folder
- refactor testing setup

## Manual test setup

1. Run latest es/kibana locally from kibana repo source
2. In DevTools:
```graphql
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "text" },
        "timestamp": { "type": "date" }
      }
    }
  }
}

PUT _data_stream/foo-ds-1

# Introduce a conflict mapping in index-template
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "boolean" },
        "timestamp": { "type": "date" }
      }
    }
  }
}
```
 4. Go to `/app/management/data/index_management/component_templates`
5. Create a new template that is not referenced by any `index_template`
and has a `@custom` suffix, ex. `random-1234@custom`
6. Verify the behavior: Before this PR change a modal asking to rollover
conflicting data-stream foo-ds-1 will appear, and after this PR no modal
will appear.

!Important Do not click `apply now and rollover` in the modal as it will
mess up setup to verify before/after fix.

## Release note

- Fixed a bug in component template creation flow where a new component
template with `@custom` suffix in name would lead to updating mappings
of all unrelated data-streams and a popup would appear asking to
rollover conflicting ones.

(cherry picked from commit bb5514b)

# Conflicts:
#	x-pack/platform/plugins/shared/index_management/server/routes/api/component_templates/component_templates.test.ts
kibanamachine added a commit that referenced this pull request Oct 12, 2025
…37952) (#238528)

# Backport

This will backport the following commits from `main` to `8.18`:
- [[Index Management] Fix @Custom component template creation
(#237952)](#237952)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2025-10-10T17:28:33Z","message":"[Index
Management] Fix @Custom component template creation
(#237952)\n\nAddresses #237916.\n\n- Fix
`/component_templates/{name}/datastreams` route to return empty\nwhen
the component template is not referenced by any index
template,\npreventing unintended apply-mappings and the rollover modal
for\nbrand-new `@custom` component templates\n- add test coverage for
`component_templates` routes folder\n- refactor testing setup\n\n##
Manual test setup\n\n1. Run latest es/kibana locally from kibana repo
source\n2. In DevTools:\n```graphql\nPUT
_index_template/foo-template\n{\n \"index_patterns\": [\"foo-ds-*\"],\n
\"data_stream\": {},\n \"template\": {\n \"mappings\": {\n
\"properties\": {\n \"message\": { \"type\": \"text\" },\n
\"timestamp\": { \"type\": \"date\" }\n }\n }\n }\n}\n\nPUT
_data_stream/foo-ds-1\n\n# Introduce a conflict mapping in
index-template\nPUT _index_template/foo-template\n{\n
\"index_patterns\": [\"foo-ds-*\"],\n \"data_stream\": {},\n
\"template\": {\n \"mappings\": {\n \"properties\": {\n \"message\": {
\"type\": \"boolean\" },\n \"timestamp\": { \"type\": \"date\" }\n }\n
}\n }\n}\n```\n 4. Go to
`/app/management/data/index_management/component_templates`\n5. Create a
new template that is not referenced by any `index_template`\nand has a
`@custom` suffix, ex. `random-1234@custom`\n6. Verify the behavior:
Before this PR change a modal asking to rollover\nconflicting
data-stream foo-ds-1 will appear, and after this PR no modal\nwill
appear.\n \n!Important Do not click `apply now and rollover` in the
modal as it will\nmess up setup to verify before/after fix.\n\n##
Release note\n\n- Fixed a bug in component template creation flow where
a new component\ntemplate with `@custom` suffix in name would lead to
updating mappings\nof all unrelated data-streams and a popup would
appear asking to\nrollover conflicting
ones.","sha":"bb5514b86ab5275346db2f82c41a0d7d83c85713","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Index
Management","Team:Kibana
Management","backport:version","v9.2.0","v9.3.0","v9.1.6","v8.18.9","v8.19.6"],"title":"[Index
Management] Fix @Custom component template
creation","number":237952,"url":"https://github.com/elastic/kibana/pull/237952","mergeCommit":{"message":"[Index
Management] Fix @Custom component template creation
(#237952)\n\nAddresses #237916.\n\n- Fix
`/component_templates/{name}/datastreams` route to return empty\nwhen
the component template is not referenced by any index
template,\npreventing unintended apply-mappings and the rollover modal
for\nbrand-new `@custom` component templates\n- add test coverage for
`component_templates` routes folder\n- refactor testing setup\n\n##
Manual test setup\n\n1. Run latest es/kibana locally from kibana repo
source\n2. In DevTools:\n```graphql\nPUT
_index_template/foo-template\n{\n \"index_patterns\": [\"foo-ds-*\"],\n
\"data_stream\": {},\n \"template\": {\n \"mappings\": {\n
\"properties\": {\n \"message\": { \"type\": \"text\" },\n
\"timestamp\": { \"type\": \"date\" }\n }\n }\n }\n}\n\nPUT
_data_stream/foo-ds-1\n\n# Introduce a conflict mapping in
index-template\nPUT _index_template/foo-template\n{\n
\"index_patterns\": [\"foo-ds-*\"],\n \"data_stream\": {},\n
\"template\": {\n \"mappings\": {\n \"properties\": {\n \"message\": {
\"type\": \"boolean\" },\n \"timestamp\": { \"type\": \"date\" }\n }\n
}\n }\n}\n```\n 4. Go to
`/app/management/data/index_management/component_templates`\n5. Create a
new template that is not referenced by any `index_template`\nand has a
`@custom` suffix, ex. `random-1234@custom`\n6. Verify the behavior:
Before this PR change a modal asking to rollover\nconflicting
data-stream foo-ds-1 will appear, and after this PR no modal\nwill
appear.\n \n!Important Do not click `apply now and rollover` in the
modal as it will\nmess up setup to verify before/after fix.\n\n##
Release note\n\n- Fixed a bug in component template creation flow where
a new component\ntemplate with `@custom` suffix in name would lead to
updating mappings\nof all unrelated data-streams and a popup would
appear asking to\nrollover conflicting
ones.","sha":"bb5514b86ab5275346db2f82c41a0d7d83c85713"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","9.1","8.18","8.19"],"targetPullRequestStates":[{"branch":"9.2","label":"v9.2.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/237952","number":237952,"mergeCommit":{"message":"[Index
Management] Fix @Custom component template creation
(#237952)\n\nAddresses #237916.\n\n- Fix
`/component_templates/{name}/datastreams` route to return empty\nwhen
the component template is not referenced by any index
template,\npreventing unintended apply-mappings and the rollover modal
for\nbrand-new `@custom` component templates\n- add test coverage for
`component_templates` routes folder\n- refactor testing setup\n\n##
Manual test setup\n\n1. Run latest es/kibana locally from kibana repo
source\n2. In DevTools:\n```graphql\nPUT
_index_template/foo-template\n{\n \"index_patterns\": [\"foo-ds-*\"],\n
\"data_stream\": {},\n \"template\": {\n \"mappings\": {\n
\"properties\": {\n \"message\": { \"type\": \"text\" },\n
\"timestamp\": { \"type\": \"date\" }\n }\n }\n }\n}\n\nPUT
_data_stream/foo-ds-1\n\n# Introduce a conflict mapping in
index-template\nPUT _index_template/foo-template\n{\n
\"index_patterns\": [\"foo-ds-*\"],\n \"data_stream\": {},\n
\"template\": {\n \"mappings\": {\n \"properties\": {\n \"message\": {
\"type\": \"boolean\" },\n \"timestamp\": { \"type\": \"date\" }\n }\n
}\n }\n}\n```\n 4. Go to
`/app/management/data/index_management/component_templates`\n5. Create a
new template that is not referenced by any `index_template`\nand has a
`@custom` suffix, ex. `random-1234@custom`\n6. Verify the behavior:
Before this PR change a modal asking to rollover\nconflicting
data-stream foo-ds-1 will appear, and after this PR no modal\nwill
appear.\n \n!Important Do not click `apply now and rollover` in the
modal as it will\nmess up setup to verify before/after fix.\n\n##
Release note\n\n- Fixed a bug in component template creation flow where
a new component\ntemplate with `@custom` suffix in name would lead to
updating mappings\nof all unrelated data-streams and a popup would
appear asking to\nrollover conflicting
ones.","sha":"bb5514b86ab5275346db2f82c41a0d7d83c85713"}},{"branch":"9.1","label":"v9.1.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
kapral18 added a commit that referenced this pull request Oct 13, 2025
…37952) (#238560)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Index Management] Fix @Custom component template creation
(#237952)](#237952)

<!--- Backport version: 10.0.2 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2025-10-10T17:28:33Z","message":"[Index
Management] Fix @Custom component template creation
(#237952)\n\nAddresses #237916.\n\n- Fix
`/component_templates/{name}/datastreams` route to return empty\nwhen
the component template is not referenced by any index
template,\npreventing unintended apply-mappings and the rollover modal
for\nbrand-new `@custom` component templates\n- add test coverage for
`component_templates` routes folder\n- refactor testing setup\n\n##
Manual test setup\n\n1. Run latest es/kibana locally from kibana repo
source\n2. In DevTools:\n```graphql\nPUT
_index_template/foo-template\n{\n \"index_patterns\": [\"foo-ds-*\"],\n
\"data_stream\": {},\n \"template\": {\n \"mappings\": {\n
\"properties\": {\n \"message\": { \"type\": \"text\" },\n
\"timestamp\": { \"type\": \"date\" }\n }\n }\n }\n}\n\nPUT
_data_stream/foo-ds-1\n\n# Introduce a conflict mapping in
index-template\nPUT _index_template/foo-template\n{\n
\"index_patterns\": [\"foo-ds-*\"],\n \"data_stream\": {},\n
\"template\": {\n \"mappings\": {\n \"properties\": {\n \"message\": {
\"type\": \"boolean\" },\n \"timestamp\": { \"type\": \"date\" }\n }\n
}\n }\n}\n```\n 4. Go to
`/app/management/data/index_management/component_templates`\n5. Create a
new template that is not referenced by any `index_template`\nand has a
`@custom` suffix, ex. `random-1234@custom`\n6. Verify the behavior:
Before this PR change a modal asking to rollover\nconflicting
data-stream foo-ds-1 will appear, and after this PR no modal\nwill
appear.\n \n!Important Do not click `apply now and rollover` in the
modal as it will\nmess up setup to verify before/after fix.\n\n##
Release note\n\n- Fixed a bug in component template creation flow where
a new component\ntemplate with `@custom` suffix in name would lead to
updating mappings\nof all unrelated data-streams and a popup would
appear asking to\nrollover conflicting
ones.","sha":"bb5514b86ab5275346db2f82c41a0d7d83c85713","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Index
Management","Team:Kibana
Management","backport:version","v9.2.0","v9.3.0","v9.1.6","v8.18.9","v8.19.6"],"title":"[Index
Management] Fix @Custom component template
creation","number":237952,"url":"https://github.com/elastic/kibana/pull/237952","mergeCommit":{"message":"[Index
Management] Fix @Custom component template creation
(#237952)\n\nAddresses #237916.\n\n- Fix
`/component_templates/{name}/datastreams` route to return empty\nwhen
the component template is not referenced by any index
template,\npreventing unintended apply-mappings and the rollover modal
for\nbrand-new `@custom` component templates\n- add test coverage for
`component_templates` routes folder\n- refactor testing setup\n\n##
Manual test setup\n\n1. Run latest es/kibana locally from kibana repo
source\n2. In DevTools:\n```graphql\nPUT
_index_template/foo-template\n{\n \"index_patterns\": [\"foo-ds-*\"],\n
\"data_stream\": {},\n \"template\": {\n \"mappings\": {\n
\"properties\": {\n \"message\": { \"type\": \"text\" },\n
\"timestamp\": { \"type\": \"date\" }\n }\n }\n }\n}\n\nPUT
_data_stream/foo-ds-1\n\n# Introduce a conflict mapping in
index-template\nPUT _index_template/foo-template\n{\n
\"index_patterns\": [\"foo-ds-*\"],\n \"data_stream\": {},\n
\"template\": {\n \"mappings\": {\n \"properties\": {\n \"message\": {
\"type\": \"boolean\" },\n \"timestamp\": { \"type\": \"date\" }\n }\n
}\n }\n}\n```\n 4. Go to
`/app/management/data/index_management/component_templates`\n5. Create a
new template that is not referenced by any `index_template`\nand has a
`@custom` suffix, ex. `random-1234@custom`\n6. Verify the behavior:
Before this PR change a modal asking to rollover\nconflicting
data-stream foo-ds-1 will appear, and after this PR no modal\nwill
appear.\n \n!Important Do not click `apply now and rollover` in the
modal as it will\nmess up setup to verify before/after fix.\n\n##
Release note\n\n- Fixed a bug in component template creation flow where
a new component\ntemplate with `@custom` suffix in name would lead to
updating mappings\nof all unrelated data-streams and a popup would
appear asking to\nrollover conflicting
ones.","sha":"bb5514b86ab5275346db2f82c41a0d7d83c85713"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.2","label":"v9.2.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/238529","number":238529,"state":"MERGED","mergeCommit":{"sha":"26eaa353bf72a95b6791135be6dc60f20690b67c","message":"[9.2]
[Index Management] Fix @Custom component template creation (#237952)
(#238529)\n\n# Backport\n\nThis will backport the following commits from
`main` to `9.2`:\n- [[Index Management] Fix @Custom component template
creation\n(#237952)](https://github.com/elastic/kibana/pull/237952)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Karen Grigoryan
<karen.grigoryan@elastic.co>"}},{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/237952","number":237952,"mergeCommit":{"message":"[Index
Management] Fix @Custom component template creation
(#237952)\n\nAddresses #237916.\n\n- Fix
`/component_templates/{name}/datastreams` route to return empty\nwhen
the component template is not referenced by any index
template,\npreventing unintended apply-mappings and the rollover modal
for\nbrand-new `@custom` component templates\n- add test coverage for
`component_templates` routes folder\n- refactor testing setup\n\n##
Manual test setup\n\n1. Run latest es/kibana locally from kibana repo
source\n2. In DevTools:\n```graphql\nPUT
_index_template/foo-template\n{\n \"index_patterns\": [\"foo-ds-*\"],\n
\"data_stream\": {},\n \"template\": {\n \"mappings\": {\n
\"properties\": {\n \"message\": { \"type\": \"text\" },\n
\"timestamp\": { \"type\": \"date\" }\n }\n }\n }\n}\n\nPUT
_data_stream/foo-ds-1\n\n# Introduce a conflict mapping in
index-template\nPUT _index_template/foo-template\n{\n
\"index_patterns\": [\"foo-ds-*\"],\n \"data_stream\": {},\n
\"template\": {\n \"mappings\": {\n \"properties\": {\n \"message\": {
\"type\": \"boolean\" },\n \"timestamp\": { \"type\": \"date\" }\n }\n
}\n }\n}\n```\n 4. Go to
`/app/management/data/index_management/component_templates`\n5. Create a
new template that is not referenced by any `index_template`\nand has a
`@custom` suffix, ex. `random-1234@custom`\n6. Verify the behavior:
Before this PR change a modal asking to rollover\nconflicting
data-stream foo-ds-1 will appear, and after this PR no modal\nwill
appear.\n \n!Important Do not click `apply now and rollover` in the
modal as it will\nmess up setup to verify before/after fix.\n\n##
Release note\n\n- Fixed a bug in component template creation flow where
a new component\ntemplate with `@custom` suffix in name would lead to
updating mappings\nof all unrelated data-streams and a popup would
appear asking to\nrollover conflicting
ones.","sha":"bb5514b86ab5275346db2f82c41a0d7d83c85713"}},{"branch":"9.1","label":"v9.1.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/238528","number":238528,"state":"OPEN"},{"branch":"8.19","label":"v8.19.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
kapral18 added a commit that referenced this pull request Oct 13, 2025
…7952) (#238559)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Index Management] Fix @Custom component template creation
(#237952)](#237952)

<!--- Backport version: 10.0.2 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2025-10-10T17:28:33Z","message":"[Index
Management] Fix @Custom component template creation
(#237952)\n\nAddresses #237916.\n\n- Fix
`/component_templates/{name}/datastreams` route to return empty\nwhen
the component template is not referenced by any index
template,\npreventing unintended apply-mappings and the rollover modal
for\nbrand-new `@custom` component templates\n- add test coverage for
`component_templates` routes folder\n- refactor testing setup\n\n##
Manual test setup\n\n1. Run latest es/kibana locally from kibana repo
source\n2. In DevTools:\n```graphql\nPUT
_index_template/foo-template\n{\n \"index_patterns\": [\"foo-ds-*\"],\n
\"data_stream\": {},\n \"template\": {\n \"mappings\": {\n
\"properties\": {\n \"message\": { \"type\": \"text\" },\n
\"timestamp\": { \"type\": \"date\" }\n }\n }\n }\n}\n\nPUT
_data_stream/foo-ds-1\n\n# Introduce a conflict mapping in
index-template\nPUT _index_template/foo-template\n{\n
\"index_patterns\": [\"foo-ds-*\"],\n \"data_stream\": {},\n
\"template\": {\n \"mappings\": {\n \"properties\": {\n \"message\": {
\"type\": \"boolean\" },\n \"timestamp\": { \"type\": \"date\" }\n }\n
}\n }\n}\n```\n 4. Go to
`/app/management/data/index_management/component_templates`\n5. Create a
new template that is not referenced by any `index_template`\nand has a
`@custom` suffix, ex. `random-1234@custom`\n6. Verify the behavior:
Before this PR change a modal asking to rollover\nconflicting
data-stream foo-ds-1 will appear, and after this PR no modal\nwill
appear.\n \n!Important Do not click `apply now and rollover` in the
modal as it will\nmess up setup to verify before/after fix.\n\n##
Release note\n\n- Fixed a bug in component template creation flow where
a new component\ntemplate with `@custom` suffix in name would lead to
updating mappings\nof all unrelated data-streams and a popup would
appear asking to\nrollover conflicting
ones.","sha":"bb5514b86ab5275346db2f82c41a0d7d83c85713","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Index
Management","Team:Kibana
Management","backport:version","v9.2.0","v9.3.0","v9.1.6","v8.18.9","v8.19.6"],"title":"[Index
Management] Fix @Custom component template
creation","number":237952,"url":"https://github.com/elastic/kibana/pull/237952","mergeCommit":{"message":"[Index
Management] Fix @Custom component template creation
(#237952)\n\nAddresses #237916.\n\n- Fix
`/component_templates/{name}/datastreams` route to return empty\nwhen
the component template is not referenced by any index
template,\npreventing unintended apply-mappings and the rollover modal
for\nbrand-new `@custom` component templates\n- add test coverage for
`component_templates` routes folder\n- refactor testing setup\n\n##
Manual test setup\n\n1. Run latest es/kibana locally from kibana repo
source\n2. In DevTools:\n```graphql\nPUT
_index_template/foo-template\n{\n \"index_patterns\": [\"foo-ds-*\"],\n
\"data_stream\": {},\n \"template\": {\n \"mappings\": {\n
\"properties\": {\n \"message\": { \"type\": \"text\" },\n
\"timestamp\": { \"type\": \"date\" }\n }\n }\n }\n}\n\nPUT
_data_stream/foo-ds-1\n\n# Introduce a conflict mapping in
index-template\nPUT _index_template/foo-template\n{\n
\"index_patterns\": [\"foo-ds-*\"],\n \"data_stream\": {},\n
\"template\": {\n \"mappings\": {\n \"properties\": {\n \"message\": {
\"type\": \"boolean\" },\n \"timestamp\": { \"type\": \"date\" }\n }\n
}\n }\n}\n```\n 4. Go to
`/app/management/data/index_management/component_templates`\n5. Create a
new template that is not referenced by any `index_template`\nand has a
`@custom` suffix, ex. `random-1234@custom`\n6. Verify the behavior:
Before this PR change a modal asking to rollover\nconflicting
data-stream foo-ds-1 will appear, and after this PR no modal\nwill
appear.\n \n!Important Do not click `apply now and rollover` in the
modal as it will\nmess up setup to verify before/after fix.\n\n##
Release note\n\n- Fixed a bug in component template creation flow where
a new component\ntemplate with `@custom` suffix in name would lead to
updating mappings\nof all unrelated data-streams and a popup would
appear asking to\nrollover conflicting
ones.","sha":"bb5514b86ab5275346db2f82c41a0d7d83c85713"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.2","label":"v9.2.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/238529","number":238529,"state":"MERGED","mergeCommit":{"sha":"26eaa353bf72a95b6791135be6dc60f20690b67c","message":"[9.2]
[Index Management] Fix @Custom component template creation (#237952)
(#238529)\n\n# Backport\n\nThis will backport the following commits from
`main` to `9.2`:\n- [[Index Management] Fix @Custom component template
creation\n(#237952)](https://github.com/elastic/kibana/pull/237952)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Karen Grigoryan
<karen.grigoryan@elastic.co>"}},{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/237952","number":237952,"mergeCommit":{"message":"[Index
Management] Fix @Custom component template creation
(#237952)\n\nAddresses #237916.\n\n- Fix
`/component_templates/{name}/datastreams` route to return empty\nwhen
the component template is not referenced by any index
template,\npreventing unintended apply-mappings and the rollover modal
for\nbrand-new `@custom` component templates\n- add test coverage for
`component_templates` routes folder\n- refactor testing setup\n\n##
Manual test setup\n\n1. Run latest es/kibana locally from kibana repo
source\n2. In DevTools:\n```graphql\nPUT
_index_template/foo-template\n{\n \"index_patterns\": [\"foo-ds-*\"],\n
\"data_stream\": {},\n \"template\": {\n \"mappings\": {\n
\"properties\": {\n \"message\": { \"type\": \"text\" },\n
\"timestamp\": { \"type\": \"date\" }\n }\n }\n }\n}\n\nPUT
_data_stream/foo-ds-1\n\n# Introduce a conflict mapping in
index-template\nPUT _index_template/foo-template\n{\n
\"index_patterns\": [\"foo-ds-*\"],\n \"data_stream\": {},\n
\"template\": {\n \"mappings\": {\n \"properties\": {\n \"message\": {
\"type\": \"boolean\" },\n \"timestamp\": { \"type\": \"date\" }\n }\n
}\n }\n}\n```\n 4. Go to
`/app/management/data/index_management/component_templates`\n5. Create a
new template that is not referenced by any `index_template`\nand has a
`@custom` suffix, ex. `random-1234@custom`\n6. Verify the behavior:
Before this PR change a modal asking to rollover\nconflicting
data-stream foo-ds-1 will appear, and after this PR no modal\nwill
appear.\n \n!Important Do not click `apply now and rollover` in the
modal as it will\nmess up setup to verify before/after fix.\n\n##
Release note\n\n- Fixed a bug in component template creation flow where
a new component\ntemplate with `@custom` suffix in name would lead to
updating mappings\nof all unrelated data-streams and a popup would
appear asking to\nrollover conflicting
ones.","sha":"bb5514b86ab5275346db2f82c41a0d7d83c85713"}},{"branch":"9.1","label":"v9.1.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/238528","number":238528,"state":"OPEN"},{"branch":"8.19","label":"v8.19.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
rylnd pushed a commit to rylnd/kibana that referenced this pull request Oct 17, 2025
…37952)

Addresses elastic#237916.

- Fix `/component_templates/{name}/datastreams` route to return empty
when the component template is not referenced by any index template,
preventing unintended apply-mappings and the rollover modal for
brand-new `@custom` component templates
- add test coverage for `component_templates` routes folder
- refactor testing setup

## Manual test setup

1. Run latest es/kibana locally from kibana repo source
2. In DevTools:
```graphql
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "text" },
        "timestamp": { "type": "date" }
      }
    }
  }
}

PUT _data_stream/foo-ds-1

# Introduce a conflict mapping in index-template
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "boolean" },
        "timestamp": { "type": "date" }
      }
    }
  }
}
```
 4. Go to `/app/management/data/index_management/component_templates`
5. Create a new template that is not referenced by any `index_template`
and has a `@custom` suffix, ex. `random-1234@custom`
6. Verify the behavior: Before this PR change a modal asking to rollover
conflicting data-stream foo-ds-1 will appear, and after this PR no modal
will appear.
 
!Important Do not click `apply now and rollover` in the modal as it will
mess up setup to verify before/after fix.

## Release note

- Fixed a bug in component template creation flow where a new component
template with `@custom` suffix in name would lead to updating mappings
of all unrelated data-streams and a popup would appear asking to
rollover conflicting ones.
nickpeihl pushed a commit to nickpeihl/kibana that referenced this pull request Oct 23, 2025
…37952)

Addresses elastic#237916.

- Fix `/component_templates/{name}/datastreams` route to return empty
when the component template is not referenced by any index template,
preventing unintended apply-mappings and the rollover modal for
brand-new `@custom` component templates
- add test coverage for `component_templates` routes folder
- refactor testing setup

## Manual test setup

1. Run latest es/kibana locally from kibana repo source
2. In DevTools:
```graphql
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "text" },
        "timestamp": { "type": "date" }
      }
    }
  }
}

PUT _data_stream/foo-ds-1

# Introduce a conflict mapping in index-template
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "boolean" },
        "timestamp": { "type": "date" }
      }
    }
  }
}
```
 4. Go to `/app/management/data/index_management/component_templates`
5. Create a new template that is not referenced by any `index_template`
and has a `@custom` suffix, ex. `random-1234@custom`
6. Verify the behavior: Before this PR change a modal asking to rollover
conflicting data-stream foo-ds-1 will appear, and after this PR no modal
will appear.
 
!Important Do not click `apply now and rollover` in the modal as it will
mess up setup to verify before/after fix.

## Release note

- Fixed a bug in component template creation flow where a new component
template with `@custom` suffix in name would lead to updating mappings
of all unrelated data-streams and a popup would appear asking to
rollover conflicting ones.
NicholasPeretti pushed a commit to NicholasPeretti/kibana that referenced this pull request Oct 27, 2025
…37952)

Addresses elastic#237916.

- Fix `/component_templates/{name}/datastreams` route to return empty
when the component template is not referenced by any index template,
preventing unintended apply-mappings and the rollover modal for
brand-new `@custom` component templates
- add test coverage for `component_templates` routes folder
- refactor testing setup

## Manual test setup

1. Run latest es/kibana locally from kibana repo source
2. In DevTools:
```graphql
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "text" },
        "timestamp": { "type": "date" }
      }
    }
  }
}

PUT _data_stream/foo-ds-1

# Introduce a conflict mapping in index-template
PUT _index_template/foo-template
{
  "index_patterns": ["foo-ds-*"],
  "data_stream": {},
  "template": {
    "mappings": {
      "properties": {
        "message": { "type": "boolean" },
        "timestamp": { "type": "date" }
      }
    }
  }
}
```
 4. Go to `/app/management/data/index_management/component_templates`
5. Create a new template that is not referenced by any `index_template`
and has a `@custom` suffix, ex. `random-1234@custom`
6. Verify the behavior: Before this PR change a modal asking to rollover
conflicting data-stream foo-ds-1 will appear, and after this PR no modal
will appear.
 
!Important Do not click `apply now and rollover` in the modal as it will
mess up setup to verify before/after fix.

## Release note

- Fixed a bug in component template creation flow where a new component
template with `@custom` suffix in name would lead to updating mappings
of all unrelated data-streams and a popup would appear asking to
rollover conflicting ones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels Feature:Index Management Index and index templates UI release_note:fix Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// v8.18.9 v8.19.6 v9.1.6 v9.2.0 v9.3.0

4 participants