# Path\_match object name Dynamic templates

**URL:** https://discuss.elastic.co/t/path-match-object-name-dynamic-templates/193715
**Category:** Elasticsearch
**Created:** [August 5, 2019, 4:19am UTC](https://discuss.elastic.co/t/path-match-object-name-dynamic-templates/193715 "2019-08-05T04:19:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![golmartvietnam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/golmartvietnam/32/51603_2.png) [@golmartvietnam](https://discuss.elastic.co/u/golmartvietnam)
#### Post date: [August 5, 2019, 4:19am UTC](https://discuss.elastic.co/t/path-match-object-name-dynamic-templates/193715/1 "2019-08-05T04:19:43Z")

</div>

Hello,

I created the following dynamic template to apply a custom mapping on the "kubernetes" object and it's subobjects and fields:

It should match these:  
kubernetes.container.name  
kubernetes.pod.name  
kubernetes.pod.id  
kubernetes.namespace  
{  
"kubernetes\_object": {  
"path\_match": "kubernetes\*",  
"mapping": {  
"dynamic": true  
}  
}  
}  
The problem is, it also matches fields like [🤔](https://golmart.com.vn/)

> kuberneteser.container.name

> kubernetesaaaaa.container.name

How can I match **kubernetes.** exactly? I tried various syntaxes but had no luck

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [August 5, 2019, 9:52am UTC](https://discuss.elastic.co/t/path-match-object-name-dynamic-templates/193715/2 "2019-08-05T09:52:37Z")

</div>

how about this (unless I misunderstood you).

```auto
PUT my_index
{
  "mappings": {
    "dynamic_templates": [
      {
        "kubernetes": {
          "path_match": "kubernetes.*",
          "mapping": {
            "type": "keyword"
          }
        }
      }
    ]
  }
}

PUT my_index/_doc/1
{
  "kuebernetes": {
    "foo": "bar"
  },
  "kuebernetesaaaa": true
}

GET my_index/_mapping

```

---

<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: [September 2, 2019, 9:52am UTC](https://discuss.elastic.co/t/path-match-object-name-dynamic-templates/193715/3 "2019-09-02T09:52:37Z")

</div>

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