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


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.


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

(austin lee) #3

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.


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?

(system) #5