Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Entity Analytics] API changes for right placement of deleting the ol…
…d component template (elastic#199734) ## Summary - Delete the old component template after the index template has referenced to the new component template - Test cases for the same flow ```JSON # Let's assume this is 8.15.3 # Create the component template when Risk Score engine is initialised # Create the index template which references the created component template PUT /_component_template/.risk-score-mappings { "template": { "settings": { "number_of_shards": 1 }, "mappings": { "properties": { "timestamp": { "type": "date" }, "user": { "properties": { "id": { "type": "keyword" }, "name": { "type": "text" } } } } } }, "version": 1 } PUT /_index_template/.risk-score.risk-score-default-index-template { "index_patterns": [".risk-score.risk-score-default-index-template"], "template": { "settings": { "number_of_replicas": 1 } }, "composed_of": [".risk-score-mappings"], "priority": 100, "version": 1, "_meta": { "description": "Index template for indices with the pattern my_index-*" } } # The deployment is updated to 8.16 # User tries to enable the Entity store which init's the Risk Score engine (again!!) # Fails, but creates the component template and cannot update the index template to reference the new component template due to the error PUT /_component_template/.risk-score-mappings-default { "template": { "settings": { "number_of_shards": 1 }, "mappings": { "properties": { "timestamp": { "type": "date" }, "user": { "properties": { "id": { "type": "keyword" }, "name": { "type": "text" } } } } } }, "version": 1 } GET /_component_template?filter_path=component_templates.name&name=.risk-score-mappings* DELETE /_component_template/.risk-score-mappings # Fails # changed flow PUT /_index_template/.risk-score.risk-score-default-index-template { "index_patterns": [".risk-score.risk-score-default-index-template"], "template": { "settings": { "number_of_replicas": 1 } }, "composed_of": [".risk-score-mappings-default"], "priority": 100, "version": 1, "_meta": { "description": "Index template for indices with the pattern my_index-*" } } DELETE /_component_template/.risk-score-mappings # Succeeds ######### ``` ### Checklist Delete any items that are not applicable to this PR. - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels) - [ ] This will appear in the **Release Notes** and follow the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- Loading branch information