Skip to content

Conversation

@mrodm
Copy link
Contributor

@mrodm mrodm commented Jan 13, 2025

Relates #2285

At least, system tests are failing in cef package due to a type set in the mapping for url.original different from ECS.

That mapping comes from the dynamic templates created with the import_mappings setting.

This PR tries to solve this error in cef package by updating the ECS mappings that elastic-package adds automatically via the import_mappings setting.

Currently, the embedded dynamic template created by elastic-package when import_mappings is enabled does not take any effect (it does not match path_match):

 { "_embedded_ecs-url_original_to_multifield": { "path_match": "*.url.original", "mapping": { "fields": { "text": { "type": "match_only_text" } }, "type": "wildcard" } } },

The goal of this PR is to update that dynamic template to be as similar as possible to the ecs@mappings component template (without unmatch_mapping_type parameter since it is not supported in 8.6.x):

 { "ecs_path_match_wildcard_and_match_only_text": { "path_match": [ "*.body.content", "*url.full", "*url.original" ], "unmatch_mapping_type": "object", "mapping": { "fields": { "text": { "type": "match_only_text" } }, "type": "wildcard" } } },

This PR has been tested:

@mrodm mrodm self-assigned this Jan 13, 2025
@mrodm
Copy link
Contributor Author

mrodm commented Jan 13, 2025

test integrations

@elastic-vault-github-plugin-prod

Created or updated PR in integrations repository to test this version. Check elastic/integrations#12337

@mrodm mrodm changed the title Update import mapping url.original Update dynamic template for url.original and url.full (import_mappings setting) Jan 13, 2025
mrodm added 2 commits January 14, 2025 13:46
Update dynamic templates for url.full and url.original fields added when import_mappings setting is enabled
@mrodm mrodm force-pushed the update-import-mapping-url.original branch from 6c3710c to e785a1a Compare January 14, 2025 12:46
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mrodm

@mrodm mrodm marked this pull request as ready for review January 14, 2025 14:54
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated dynamic templates to be as similar as possible to the ecs@mappings component template:
https://github.com/elastic/elasticsearch/blob/09df99393193b2c53d92899662a8b8b3c55b45cd/x-pack/plugin/core/template-resources/src/main/resources/ecs%40mappings.json#L54-L69

Packages that rely on these dynamic templates should publish a new version in order to get the changes.

@mrodm mrodm merged commit 6463b0f into elastic:main Jan 14, 2025
3 checks passed
@mrodm mrodm deleted the update-import-mapping-url.original branch January 14, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants