You accomplish this with dynamic patterns yes, by creating a dynamic mapping for fields (or field patterns, for example, all rows), for example:
"dynamic_templates":[ { "template_myStringFields":{ "match":"somepattern", "mapping":{ "type":"multi_field", "fields":{ "{name}":{ "type":"string", "index":"not_analyzed", }, "_tokenized":{ "type":"string", "index":"analyzed", } } } } }...
Then, in order to search both in the analysis and not be analyzed, you can use “pattern matching” if you do not like to search in both fields at the same time or look for the _all field if it matches any field. The field name is the same, but with postfix, for example myField._tokenized in the above example.
source share