Template setting some fields to not analyzed

Hello,

Here is the snipped of my index mapping. It's a dynamically generated mapping, but in my template I want to be able to convert beat.hostname and beat.name to 'not_analyzed'. Is there a way to explicitly define this, but at the same time let everything else get assigned dynamically as it's now?

curl -XGET localhost:9200/topbeat-2016.04.28/_mapping/filesystem?pretty
{
"topbeat-2016.04.28" : {
"mappings" : {
"filesystem" : {
"properties" : {
"@timestamp" : {
"type" : "date",
"format" : "strict_date_optional_time||epoch_millis"
},
"@version" : {
"type" : "string"
},
"beat" : {
"properties" : {
"hostname" : {
"type" : "string"
},
"name" : {
"type" : "string"
}
}
},
"beatsource" : {
"type" : "string"
},
"count" : {
"type" : "long"
},
"dc" : {
"type" : "string"
},
"fs" : {
"properties" : {
"avail" : {
"type" : "long"
},
"device_name" : {
"type" : "string"
},
"files" : {
"type" : "long"
},
"free" : {
"type" : "long"
},
"free_files" : {
"type" : "long"
},
"mount_point" : {
"type" : "string"
},
"total" : {
"type" : "long"
},
"used" : {
"type" : "long"
},
"used_p" : {
"type" : "long"
}
}
},
"host" : {
"type" : "string"
},
"kafka" : {
"properties" : {
"consumer_group" : {
"type" : "string"
},
"msg_size" : {
"type" : "long"
},
"partition" : {
"type" : "long"
},
"topic" : {
"type" : "string"
}
}
},
"platform" : {
"type" : "string"
},
"tags" : {
"type" : "string"
},
"type" : {
"type" : "string"
}
}
}
}
}
}

Just try setting like this:

curl -XPUT 'localhost:9200/_template/my_temp_name' -d '
{
        "order": 0,
        "template": "my_index_name*",
        "settings": {
            "index.number_of_shards": "5"
        },
        "mappings": {
            "_default_": {
                "dynamic_templates": [
                    {
                        "string": {
                            "mapping": {
                                "index": "not_analyzed",
                                "type": "string"
                            },
                            "match": "hostname*"
                        }
                    }
                ]
            }
        },
        "aliases": {}
    }
}
'

Thanks