beats icon indicating copy to clipboard operation
beats copied to clipboard

Static mappings are generated for dynamic fields definitions

Open jsoriano opened this issue 3 years ago • 1 comments

Fields definitions for dynamic mappings generate the dynamic mapping, but also an static mapping with a member named *. This seems unexpected.

For example the following field definition:

    - name: core.*.pct
      type: object
      object_type: scaled_float
      format: percent
      description: >
        Percentage of CPU time in this core.

Produces these mappings (as seen with metricbeat export template):

  "template": {
    "mappings": {
      ...
      "dynamic_templates": [
         ...
         {
          "docker.cpu.core.*.pct": {
            "mapping": {
              "scaling_factor": 1000,
              "type": "scaled_float"
            },
            "match_mapping_type": "*",
            "path_match": "docker.cpu.core.*.pct"
          }
        },
        ...
      ],
      "properties": {
        "docker": {
          "properties": {
            ...
            "cpu": {
              "properties": {
                "core": {
                  "properties": {
                    "*": {
                      "properties": {
                        "pct": {
                          "type": "object"
                        },
                        ...
                      }
                    }
                  }
                },
             }
      ...

The dynamic mapping seems correct, but the other one looks like a static definition for an object field called literally docker.cpu.core.*.pct, what seems unexpected.

Found while investigating https://github.com/elastic/kibana/issues/129344#issuecomment-1201575075.

jsoriano avatar Aug 02 '22 09:08 jsoriano

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

elasticmachine avatar Aug 02 '22 09:08 elasticmachine

Hi! We just realized that we haven't looked into this issue in a while. We're sorry!

We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1. Thank you for your contribution!

botelastic[bot] avatar Aug 02 '23 10:08 botelastic[bot]