Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.12] [Fleet] Fix conflicting dynamic template mappings for intermed…
…iate objects (#175970) (#175991) # Backport This will backport the following commits from `main` to `8.12`: - [[Fleet] Fix conflicting dynamic template mappings for intermediate objects (#175970)](#175970) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jaime Soriano Pastor","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-01-31T14:51:39Z","message":"[Fleet] Fix conflicting dynamic template mappings for intermediate objects (#175970)\n\nWhen there are multiple dynamic templates with the same name, we only\r\nuse the first appearance.\r\nAdd an exception for intermediate objects, so we use the last\r\nappearance. This way we avoid that less specific dynamic templates\r\ncreated for intermediate objects match before more specific dynamic\r\ntemplates defined in packages.\r\n\r\nThis was a problem for example in the Prometheus package, where there\r\nare definitions for `prometheus.*.value` and `prometheus.*.histogram`.\r\nFor both cases Fleet tries to create a dynamic template for the\r\nintermediate objects `prometheus.*`. If this dynamic template is\r\ninserted before the dynamic template for the histograms, it matches for\r\nthem, causing mapping errors on ingestion, like the following one:\r\n```\r\nmapper [prometheus.queue_duration.histogram.values] cannot be changed from type [float] to [long]\r\n```\r\nWith this change, when multiple definitions generate the same dynamic\r\ntemplate for intermediate objects, only the last one ends up in the\r\ntemplate.\r\n\r\nThese intermediate objects were introduced in 8.12, after https://github.com/elastic/kibana/pull/169981.","sha":"7274f6e2e152928418a677fcb6b9c3550b8a6227","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Fleet","backport:prev-minor","v8.12.1","v8.13.0"],"title":"[Fleet] Fix conflicting dynamic template mappings for intermediate objects","number":175970,"url":"https://github.com/elastic/kibana/pull/175970","mergeCommit":{"message":"[Fleet] Fix conflicting dynamic template mappings for intermediate objects (#175970)\n\nWhen there are multiple dynamic templates with the same name, we only\r\nuse the first appearance.\r\nAdd an exception for intermediate objects, so we use the last\r\nappearance. This way we avoid that less specific dynamic templates\r\ncreated for intermediate objects match before more specific dynamic\r\ntemplates defined in packages.\r\n\r\nThis was a problem for example in the Prometheus package, where there\r\nare definitions for `prometheus.*.value` and `prometheus.*.histogram`.\r\nFor both cases Fleet tries to create a dynamic template for the\r\nintermediate objects `prometheus.*`. If this dynamic template is\r\ninserted before the dynamic template for the histograms, it matches for\r\nthem, causing mapping errors on ingestion, like the following one:\r\n```\r\nmapper [prometheus.queue_duration.histogram.values] cannot be changed from type [float] to [long]\r\n```\r\nWith this change, when multiple definitions generate the same dynamic\r\ntemplate for intermediate objects, only the last one ends up in the\r\ntemplate.\r\n\r\nThese intermediate objects were introduced in 8.12, after https://github.com/elastic/kibana/pull/169981.","sha":"7274f6e2e152928418a677fcb6b9c3550b8a6227"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/175970","number":175970,"mergeCommit":{"message":"[Fleet] Fix conflicting dynamic template mappings for intermediate objects (#175970)\n\nWhen there are multiple dynamic templates with the same name, we only\r\nuse the first appearance.\r\nAdd an exception for intermediate objects, so we use the last\r\nappearance. This way we avoid that less specific dynamic templates\r\ncreated for intermediate objects match before more specific dynamic\r\ntemplates defined in packages.\r\n\r\nThis was a problem for example in the Prometheus package, where there\r\nare definitions for `prometheus.*.value` and `prometheus.*.histogram`.\r\nFor both cases Fleet tries to create a dynamic template for the\r\nintermediate objects `prometheus.*`. If this dynamic template is\r\ninserted before the dynamic template for the histograms, it matches for\r\nthem, causing mapping errors on ingestion, like the following one:\r\n```\r\nmapper [prometheus.queue_duration.histogram.values] cannot be changed from type [float] to [long]\r\n```\r\nWith this change, when multiple definitions generate the same dynamic\r\ntemplate for intermediate objects, only the last one ends up in the\r\ntemplate.\r\n\r\nThese intermediate objects were introduced in 8.12, after https://github.com/elastic/kibana/pull/169981.","sha":"7274f6e2e152928418a677fcb6b9c3550b8a6227"}}]}] BACKPORT--> Co-authored-by: Jaime Soriano Pastor <[email protected]>
- Loading branch information