[Index Management] Fix @custom component template creation#237952
Conversation
c869ae4 to
cfeb7e7
Compare
|
Pinging @elastic/kibana-management (Team:Kibana Management) |
48cadf3 to
60d1015
Compare
|
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. |
|
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. |
|
@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 |
ElenaStoeva
left a comment
There was a problem hiding this comment.
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?
bf0c885 to
9282f3c
Compare
e7b2ed9 to
9f52716
Compare
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.
9f52716 to
ccf807b
Compare
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
History
|
|
Starting backport for target branches: 8.18, 8.19, 9.1, 9.2 |
…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)
…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)
💔 Some backports could not be created
Note: Successful backport PRs will be merged automatically after passing CI. Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
…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>
…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)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…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
…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>
…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-->
…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-->
…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.
…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.
…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.
Addresses #237916.
/component_templates/{name}/datastreamsroute 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@customcomponent templatescomponent_templatesroutes folderManual test setup
/app/management/data/index_management/component_templatesindex_templateand has a@customsuffix, ex.random-1234@custom!Important Do not click
apply now and rolloverin the modal as it will mess up setup to verify before/after fix.Release note
@customsuffix in name would lead to updating mappings of all unrelated data-streams and a popup would appear asking to rollover conflicting ones.