# Elasticsearch and dynamic mappings

**URL:** <https://discuss.elastic.co/t/elasticsearch-and-dynamic-mappings/255643>\
**Category:** Elasticsearch\
**Created:** [November 17, 2020, 9:04am UTC](https://discuss.elastic.co/t/elasticsearch-and-dynamic-mappings/255643 "2020-11-17T09:04:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BBQigniter](https://avatars.discourse-cdn.com/v4/letter/b/3da27b/32.png) [@BBQigniter](https://discuss.elastic.co/u/BBQigniter)\
**Post date:** [November 17, 2020, 9:04am UTC](https://discuss.elastic.co/t/elasticsearch-and-dynamic-mappings/255643/1 "2020-11-17T09:04:30Z")

</div>

I have two questions about dynamic mappings.

I have set up a component template which looks like this:

```auto
PUT _component_template/syslog-mappings-dynamic
{
  "version": 1,
  "template": {
    "mappings": {
      "_source": {
        "excludes": [],
        "includes": [],
        "enabled": true
      },
      "_routing": {
        "required": false
      },
      "dynamic": true,
      "numeric_detection": true,
      "date_detection": false,
      "dynamic_templates": [
        {
          "booleans": {
            "mapping": {
              "type": "boolean"
            },
            "match_mapping_type": "boolean"
          }
        },
        {
          "numbers_decimal": {
            "mapping": {
              "type": "double"
            },
            "path_unmatch": "*.postal_code",
            "match_mapping_type": "double"
          }
        },
        {
          "numbers_no_decimal": {
            "mapping": {
              "type": "long"
            },
            "path_unmatch": "*.postal_code",
            "match_mapping_type": "long"
          }
        },
        {
          "strings_as_keywords": {
            "mapping": {
              "ignore_above": 1024,
              "type": "keyword"
            },
            "match_mapping_type": "string"
          }
        }
      ]
    }
  }
}

```

I now have the problem that if a new index is created and an ingest creates for example the dynamic field `geo.postal_code` it's often mapped as type `long`. Why is this happening even it's stated in `path_unmatch` that it shouldn't?

And second question. How can you add multiple field-definitions in `path_match` or `path_unmatch`. For example if I want to unmatch `*.postal_code` and `*.some_other_field` - can this be done with `path_unmatch: "*.postal_code, *.some_other_field"`?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 15, 2020, 9:04am UTC](https://discuss.elastic.co/t/elasticsearch-and-dynamic-mappings/255643/2 "2020-12-15T09:04:31Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
