# Dynamic template override for multi-fields

**URL:** https://discuss.elastic.co/t/dynamic-template-override-for-multi-fields/85205
**Category:** Elasticsearch
**Created:** [May 10, 2017, 8:51am UTC](https://discuss.elastic.co/t/dynamic-template-override-for-multi-fields/85205 "2017-05-10T08:51:11Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![nil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nil/32/8720_2.png) [@nil](https://discuss.elastic.co/u/nil)
#### Post date: [May 10, 2017, 8:51am UTC](https://discuss.elastic.co/t/dynamic-template-override-for-multi-fields/85205/1 "2017-05-10T08:51:12Z")

</div>

Hi,

I'm using the default logstash index template which defines all string types to be indexed as text and have a multi-field called keyword to be indexed as a keyword data type:

```
"string_fields": {
	"mapping": {
		"norms": false,
		"type": "text",
		"fields": {
			"keyword": {
			    "type": "keyword"
			}
		}
	},
	"match_mapping_type": "string",
    "match": "*"
}

```

I then want to define a custom index template for specific types, where I want string types to be mapped as keyword fields, so I have added this in my index template:

```
"string_fields": {
	"mapping": {
		"type": "keyword"
	},
	"match_mapping_type": "string",
	"match": "*"
}

```

The merged output (when asking for the index template) then looks like:

```
"string_fields": {
	"match": "*",
	"match_mapping_type": "string",
	"mapping": {
		"fields": {
			"keyword": {
				"type": "keyword"
			}
		},
		"norms": false,
		"type": "keyword"
	}
}

```

As you can see, my fields now are of type keyword but also have a multi-field of the same type. This makes sense based on the documentation which states that `the merging is "deep"`, but it's not a desired outcome.

Is there any way to (on my override template) remove the keyword multi-field?

Thanks you in advance.

---

<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: [June 7, 2017, 8:51am UTC](https://discuss.elastic.co/t/dynamic-template-override-for-multi-fields/85205/2 "2017-06-07T08:51:58Z")

</div>

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