How to set default mapping for string as "not_analyzed"? No luck with dynamic_templates

How to set default mapping for string as "not_analyzed"? No luck with dynamic_templates

I tried running this below template first in my CURL
PUT /my_index
{
"mappings": {
"my_type": {
"dynamic_templates": [
{ "notanalyzed": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "string",
"index": "not_analyzed"
}
}
}
]
}
}
}

Then with same index and type , i created a document. It seems the string value is not set to "not_analyzed" by default

Any one is having step by step solution for this or I am missing something

Hi

This works for me

PUT /_template/mytesttemplate
{
"template": "something*",
"order": 1,
"settings": {
"number_of_shards": 5
},
"mappings": {
"mytype": {
"dynamic_templates": [
{
"string_fields": {
"mapping": {
"index": "not_analyzed",
"type": "string"
},
"match_mapping_type": "string",
"match": "*"
}
}
],
"_all": {
"enabled": false
}
}
}
}

PUT /something1

GET /something1/_mapping

POST /something1/mytype/1
{
"text" : "This is a string",
"c2": "so is this"

}

GET /something1/mytype/_search
{
"query": {
"match": {
"text": "This is a string"
}
}
}