# How can I specify the default mapping for a type across all indexes?

**URL:** <https://discuss.elastic.co/t/how-can-i-specify-the-default-mapping-for-a-type-across-all-indexes/30082>\
**Category:** Elasticsearch\
**Created:** [September 27, 2015, 6:49am UTC](https://discuss.elastic.co/t/how-can-i-specify-the-default-mapping-for-a-type-across-all-indexes/30082 "2015-09-27T06:49:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LansK](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@LansK](https://discuss.elastic.co/u/LansK)\
**Post date:** [September 27, 2015, 6:49am UTC](https://discuss.elastic.co/t/how-can-i-specify-the-default-mapping-for-a-type-across-all-indexes/30082/1 "2015-09-27T06:49:44Z")

</div>

I want to make the default analyzer for the string type for ALL string fields across ALL indexes to “index”: “not\_analyzed” (or the equivalent formulation for templates).

Something like this, but this doesn’t work:

```
PUT /_template/template_for_all_indexes
{
	"template" : "*",
	"aliases" : {},
	
	"mappings": {
		"_default_": {
			"properties": {
				 "match_mapping_type": "string",
                      			"mapping": {
                          			"type": "string",
                          			"analyzer": "not_analyzed"
                     			 }
			}
      	
		}
	}
}

```

And will such a template override my more specific matching templates? In some other templates I want to make certain string fields analyzed if they have a certain name.

---

<div class="post-metadata">

**Author:** ![LansK](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@LansK](https://discuss.elastic.co/u/LansK)\
**Post date:** [October 5, 2015, 1:59pm UTC](https://discuss.elastic.co/t/how-can-i-specify-the-default-mapping-for-a-type-across-all-indexes/30082/2 "2015-10-05T13:59:48Z")

</div>

Can someone please confirm whether this is possible or not?  
Workarounds to achieve a similar outcome would be appreciated, too.

---

<div class="post-metadata">

**Author:** ![austin\_lee](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@austin\_lee](https://discuss.elastic.co/u/austin_lee)\
**Post date:** [October 5, 2015, 3:02pm UTC](https://discuss.elastic.co/t/how-can-i-specify-the-default-mapping-for-a-type-across-all-indexes/30082/3 "2015-10-05T15:02:46Z")

</div>

I use the _default_ option on a per index basis. So every time I create an index I pass the "_default_" properties.

It has worked for me with that approach.

---

<div class="post-metadata">

**Author:** ![LansK](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@LansK](https://discuss.elastic.co/u/LansK)\
**Post date:** [October 27, 2015, 8:24pm UTC](https://discuss.elastic.co/t/how-can-i-specify-the-default-mapping-for-a-type-across-all-indexes/30082/4 "2015-10-27T20:24:04Z")

</div>

Even if it is limited to a per index basis, instead of all indexes, is it possible to change the default type for every string field in an index? And if it is, can someone please provide a basic example?

---

<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:** [July 5, 2017, 11:42pm UTC](https://discuss.elastic.co/t/how-can-i-specify-the-default-mapping-for-a-type-across-all-indexes/30082/5 "2017-07-05T23:42:20Z")

</div>


