Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EPM] Dynamic mapping not being created for fields.yml entry #167553

Closed
andrewkroh opened this issue Sep 28, 2023 · 5 comments
Closed

[EPM] Dynamic mapping not being created for fields.yml entry #167553

andrewkroh opened this issue Sep 28, 2023 · 5 comments
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@andrewkroh
Copy link
Member

Kibana version: 8.10.2

Describe the bug:

Fleet is not creating dynamic_templates entries in the component template for all fields that are declared as dynamic fields (using a wildcard name and type: object). The problem appears to only occur when two fields are declared that seem to have a hierarchical relationship.

I suspect that Fleet is not making a distinction between dynamic and static field mappings when considering what fields can be removed from the template because they are non-leaf fields. That logic should not apply to dynamic fields. In this case we saw Item.* be dropped and only Item.*.* landed in the final template.

Steps to reproduce:

Create a package with these fields. Install it. Then check the Elasticsearch component template.

# fields.yml
---
   - name: o365.audit.Item.*
      type: object
      object_type: keyword
      object_type_mapping_type: '*'
   - name: o365.audit.Item.*.*
      type: object
      object_type: keyword
      object_type_mapping_type: '*'

Generated template:

"dynamic_templates": [
        {
          "o365.audit.Item.*.*": {
            "path_match": "o365.audit.Item.*.*",
            "mapping": {
              "type": "keyword"
            }
          }
        },
]

Expected behavior:

"dynamic_templates": [
        {
          "o365.audit.Item.*": {
            "path_match": "o365.audit.Item.*",
            "mapping": {
              "type": "keyword"
            }
          }
        },
        {
          "o365.audit.Item.*.*": {
            "path_match": "o365.audit.Item.*.*",
            "mapping": {
              "type": "keyword"
            }
          }
        },
]

Any additional context:

@andrewkroh andrewkroh added bug Fixes for quality problems that affect the customer experience Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Team:Fleet Team label for Observability Data Collection Fleet team labels Sep 28, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Feature:EPM)

@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@nchaulet
Copy link
Member

nchaulet commented Jan 3, 2024

@andrewkroh What the goal of the Item.* mapping, it seems to me it will result in a mapping where we will not be able to write to Item.*.* the Item.* object_type seems not correct to me

For example when testing those mappings
Screenshot 2024-01-03 at 3 37 01 PM

I think with that recent change #169981 made by @jsoriano only the o365.audit.Item.*.* mapping should be needed.

Testing it this give the following dynamic_templates

 "dynamic_templates": [
        {
          "o365.audit.Item.*.*": {
            "mapping": {
              "type": "keyword"
            },
            "match_mapping_type": "*",
            "path_match": "o365.audit.Item.*.*"
          }
        },
        {
          "o365.audit.Item.*": {
            "mapping": {
              "type": "object",
              "dynamic": true
            },
            "match_mapping_type": "object",
            "path_match": "o365.audit.Item.*"
          }
        }
      ]

@andrewkroh
Copy link
Member Author

I think you are right. I don't see a need for both o365.audit.Item.* and o365.audit.Item.*.* unless o3365.audit.Item had subobjects: false.

@nchaulet
Copy link
Member

nchaulet commented Jan 3, 2024

@andrewkroh it do not seems o3365.audit.Item has subobjects: false should we close that issue and create a new one to fix the o365 issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

No branches or pull requests

3 participants