# Beats 6.2 dynamic templates using fields.yml

**URL:** https://discuss.elastic.co/t/beats-6-2-dynamic-templates-using-fields-yml/129986
**Category:** Beats
**Created:** [April 30, 2018, 6:30am UTC](https://discuss.elastic.co/t/beats-6-2-dynamic-templates-using-fields-yml/129986 "2018-04-30T06:30:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sheen2x](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@sheen2x](https://discuss.elastic.co/u/sheen2x)
#### Post date: [April 30, 2018, 6:30am UTC](https://discuss.elastic.co/t/beats-6-2-dynamic-templates-using-fields-yml/129986/1 "2018-04-30T06:30:22Z")

</div>

Hello,

Is there a way to set dynamic templates using fields.yml?

Is there a change for dynamic templates in 6.2? Before on Beats 5.5 both text and keyword are assigned when there's a string.

I want to set the default dynamic template as shown below for all indices. I tried to use PUT in Kibana dev tools but it's unsuccessful.

```
PUT my_index
{
  "mappings": {
	"_doc": {
	  "dynamic_templates": [
		{
		  "strings": {
			"match_mapping_type": "string",
			"mapping": {
			  "type": "text",
			  "fields": {
				"keyword": {
				  "type": "keyword",
				}
			  }
			}
		  }
		}
	  ]
	}
  }
}

```

For now the dynamic template is this; I don't want this:

```
    "dynamic_templates": [
      {
        "strings_as_keyword": {
          "match_mapping_type": "string",
          "mapping": {
            "ignore_above": 1024,
            "type": "keyword"
          }
        }
      }

```

Thank you.

---

<div class="post-metadata">

### Author: ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)
#### Post date: [April 30, 2018, 10:13am UTC](https://discuss.elastic.co/t/beats-6-2-dynamic-templates-using-fields-yml/129986/3 "2018-04-30T10:13:19Z")

</div>

Hi,

With what beat do you need this? Do you want it for specific fields or for all string fields?

---

<div class="post-metadata">

### Author: ![sheen2x](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@sheen2x](https://discuss.elastic.co/u/sheen2x)
#### Post date: [April 30, 2018, 10:24am UTC](https://discuss.elastic.co/t/beats-6-2-dynamic-templates-using-fields-yml/129986/4 "2018-04-30T10:24:40Z")

</div>

Hello,

I need this for filebeat 6.2.2. I want all strings to have the dynamic template with text and keyword type.

```
  "dynamic_templates": [
	{
	  "strings": {
		"match_mapping_type": "string",
		"mapping": {
		  "type": "text",
		  "fields": {
			"keyword": {
			  "type": "keyword",
			}
		  }
		}
	  }
	}
  ]

```

Thank you.

---

<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: [May 28, 2018, 12:26pm UTC](https://discuss.elastic.co/t/beats-6-2-dynamic-templates-using-fields-yml/129986/5 "2018-05-28T12:26:06Z")

</div>

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