Always add a not_analyzed field to strings template mapping

Hi all, I have run into a problem where I have a value 'testing-beta' when I try filter this field I get no results, from my understanding its the analyser that splits it into tokens, I have tried creating a dynamic template mapping for all string values (similar to logstash) but it does not seem to have any effect.

What I want to achieve is all string fields (at all levels) to have a "{name}.raw" field that is not_analyzed or a way to filter the _source value directly. I deleted the index then added the template then reindexed all the data.


    "template" : "MyIndex",
    "mappings" : {
        "_default_" : {
            "dynamic_templates" : [ {
                "string_fields" : {
                        "path_match" : "*",
                        "match_mapping_type" : "string",
                        "mapping" : {
                            "type": "multi_field",
                            "fields": {
                                "{name}": {
                                    "type": "{dynamic_type}",
                                    "index": "analyzed"
                                "raw": {
                                    "type": "{dynamic_type}",
                                    "index": "not_analyzed"

Is that what you actually have in the mapping, and is that the actual type?

I understood that the template would create a mapping and that that would match all types, I changed it to

"type": "string",

but still get an error "bad request"