Skip to content

Add ecs@mappings component template to transform destination index template#223878

Merged
maxcold merged 3 commits intomainfrom
csp-add-ecs-mappings-to-transform-destination
Jun 17, 2025
Merged

Add ecs@mappings component template to transform destination index template#223878
maxcold merged 3 commits intomainfrom
csp-add-ecs-mappings-to-transform-destination

Conversation

@maxcold
Copy link
Copy Markdown
Contributor

@maxcold maxcold commented Jun 13, 2025

Summary

Adding ecs@mappings to the index template created by fleet for the transform destination index template

Closes:

Related discussions:

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

@maxcold maxcold added release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team Team:Cloud Security Cloud Security team related backport:version Backport to applied version labels 8.19 candidate labels Jun 13, 2025
@maxcold maxcold added v8.19.0 ci:cloud-deploy Create or update a Cloud deployment and removed 8.19 candidate labels Jun 13, 2025
@kibanamachine
Copy link
Copy Markdown
Contributor

Cloud deployment initiated, see credentials at: https://buildkite.com/elastic/kibana-deploy-cloud-from-pr/builds/241

@maxcold maxcold changed the title add ecs@mappings component template to transform destination index te… Add ecs@mappings component template to transform destination index template Jun 16, 2025
@maxcold maxcold added the v9.1.0 label Jun 16, 2025
@maxcold maxcold marked this pull request as ready for review June 16, 2025 08:30
@maxcold maxcold requested a review from a team as a code owner June 16, 2025 08:30
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/fleet (Team:Fleet)

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security)

@maxcold maxcold requested a review from a team June 16, 2025 08:30
composed_of: Object.keys(componentTemplates),
composed_of: [
...Object.keys(componentTemplates),
STACK_COMPONENT_TEMPLATE_ECS_MAPPINGS,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To confirm, is it expected that this change impacts all packages with transforms?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, we had a few discussions in the related threads:

It's an option to make this change opt-in through the package-spec, but no blockers were raised to make it happen for every transform

Copy link
Copy Markdown
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

LGTM

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Jun 16, 2025

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #9 / Entity Analytics - Entity Store @ess Host transform logic Install Entity Store and test Host transform "before each" hook for "Should return 200 and status 'running' for all engines"

Metrics [docs]

✅ unchanged

History

@maxcold maxcold merged commit 76fdb46 into main Jun 17, 2025
10 checks passed
@maxcold maxcold deleted the csp-add-ecs-mappings-to-transform-destination branch June 17, 2025 09:05
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19

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

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 223878

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jun 19, 2025
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 223878 locally
cc: @maxcold

@maxcold
Copy link
Copy Markdown
Contributor Author

maxcold commented Jun 19, 2025

💚 All backports created successfully

Status Branch Result
8.19

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

Questions ?

Please refer to the Backport tool documentation

maxcold added a commit that referenced this pull request Jun 19, 2025
…ndex template (#223878) (#224546)

# Backport

This will backport the following commits from `main` to `8.19`:
- [Add ecs@mappings component template to transform destination index
template (#223878)](#223878)

<!--- Backport version: 10.0.0 -->

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

<!--BACKPORT [{"author":{"name":"Maxim
Kholod","email":"maxim.kholod@elastic.co"},"sourceCommit":{"committedDate":"2025-06-17T09:05:10Z","message":"Add
ecs@mappings component template to transform destination index template
(#223878)\n\n## Summary\n\nAdding `ecs@mappings` to the index template
created by fleet for the\ntransform destination index
template\n\nCloses:\n-
https://github.com/elastic/security-team/issues/10720\n\nRelated
discussions:\n-
https://elastic.slack.com/archives/CJZ9U5G9X/p1749565737961249\n-\nhttps://github.com/elastic/elastic-package/issues/1641#issue-2098524093\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"76fdb46be8f3a0419c9288c12acbd9d26fd2aa2a","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","backport
missing","Team:Fleet","Team:Cloud
Security","ci:cloud-deploy","backport:version","v9.1.0","v8.19.0"],"title":"Add
ecs@mappings component template to transform destination index
template","number":223878,"url":"https://github.com/elastic/kibana/pull/223878","mergeCommit":{"message":"Add
ecs@mappings component template to transform destination index template
(#223878)\n\n## Summary\n\nAdding `ecs@mappings` to the index template
created by fleet for the\ntransform destination index
template\n\nCloses:\n-
https://github.com/elastic/security-team/issues/10720\n\nRelated
discussions:\n-
https://elastic.slack.com/archives/CJZ9U5G9X/p1749565737961249\n-\nhttps://github.com/elastic/elastic-package/issues/1641#issue-2098524093\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"76fdb46be8f3a0419c9288c12acbd9d26fd2aa2a"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/223878","number":223878,"mergeCommit":{"message":"Add
ecs@mappings component template to transform destination index template
(#223878)\n\n## Summary\n\nAdding `ecs@mappings` to the index template
created by fleet for the\ntransform destination index
template\n\nCloses:\n-
https://github.com/elastic/security-team/issues/10720\n\nRelated
discussions:\n-
https://elastic.slack.com/archives/CJZ9U5G9X/p1749565737961249\n-\nhttps://github.com/elastic/elastic-package/issues/1641#issue-2098524093\n\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"76fdb46be8f3a0419c9288c12acbd9d26fd2aa2a"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jun 19, 2025
maxcold added a commit that referenced this pull request Feb 27, 2026
## Summary

Removes client-side runtime mappings from CDR (Cloud Detection &
Response) misconfigurations and vulnerabilities data grid queries. These
runtime mappings were a workaround
([#198635](#198635)) for missing
`keyword` mappings in 3rd-party integration indexes (e.g. Wiz), which
caused sorting and grouping to fail.

**Why they're no longer needed:** The `ecs@mappings` component template
— which includes a catch-all `all_strings_to_keywords` dynamic mapping
rule — is now applied to all Fleet transform destination index templates
([#223878](#223878)). This means
all string fields in CDR latest indexes are automatically mapped as
`keyword`, making the runtime mappings redundant.

**What changed:**
- Removed 4 runtime mapping constants from `constants.ts`
- Removed `getRuntimeMappingsFromSort()` from data table query builders
(misconfigs + vulns)
- Removed `getRuntimeMappingsByGroupField()` from grouping query
builders (misconfigs + vulns)
- Added `unmapped_type: 'keyword'` to sort fields to handle indexes
where a field may not be mapped
- Fixed painless sort scripts to handle missing fields with
`doc.containsKey()` checks (previously would throw null pointer errors
for 3P documents missing native CSP fields)

Closes #198651

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [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
- [x] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### Identify risks

- **Low risk**: Sorting by fields missing in some indexes (e.g.
`rule.benchmark.rule_number` for Wiz) now relies on ES `unmapped_type`
instead of runtime mappings. Verified locally that documents are
included correctly with missing-field docs appearing at the end of sort
results.
qn895 pushed a commit to qn895/kibana that referenced this pull request Mar 11, 2026
## Summary

Removes client-side runtime mappings from CDR (Cloud Detection &
Response) misconfigurations and vulnerabilities data grid queries. These
runtime mappings were a workaround
([elastic#198635](elastic#198635)) for missing
`keyword` mappings in 3rd-party integration indexes (e.g. Wiz), which
caused sorting and grouping to fail.

**Why they're no longer needed:** The `ecs@mappings` component template
— which includes a catch-all `all_strings_to_keywords` dynamic mapping
rule — is now applied to all Fleet transform destination index templates
([elastic#223878](elastic#223878)). This means
all string fields in CDR latest indexes are automatically mapped as
`keyword`, making the runtime mappings redundant.

**What changed:**
- Removed 4 runtime mapping constants from `constants.ts`
- Removed `getRuntimeMappingsFromSort()` from data table query builders
(misconfigs + vulns)
- Removed `getRuntimeMappingsByGroupField()` from grouping query
builders (misconfigs + vulns)
- Added `unmapped_type: 'keyword'` to sort fields to handle indexes
where a field may not be mapped
- Fixed painless sort scripts to handle missing fields with
`doc.containsKey()` checks (previously would throw null pointer errors
for 3P documents missing native CSP fields)

Closes elastic#198651

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [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
- [x] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### Identify risks

- **Low risk**: Sorting by fields missing in some indexes (e.g.
`rule.benchmark.rule_number` for Wiz) now relies on ES `unmapped_type`
instead of runtime mappings. Verified locally that documents are
included correctly with missing-field docs appearing at the end of sort
results.
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 ci:cloud-deploy Create or update a Cloud deployment release_note:enhancement Team:Cloud Security Cloud Security team related Team:Fleet Team label for Observability Data Collection Fleet team v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants