Create ElasticSearch dynamic template to ensure all fields are set to not_analyzed -
i have elasticsearch type want mapping set dynamically. there few select fields on type want analyzed, else should set "not_analyzed".
i've come following snippet. sets string fields not analyzed, doesn't cover other data types. tried using "generic" field shown in documentation didn't help. can tell me how can accomplish this?
{ "typename": { "dynamic_templates": [ { "template_name": { "match": "*", "match_mapping_type": "string", "mapping": { "index": "no", "type": "string" } } } ], "dynamic": true, "properties": { "url": { "index": "analyzed", "type": "string" }, "resourceurl": { "index": "analyzed", "type": "string" } } } }
{ "mappings": { "typename": { "dynamic_templates": [ { "base": { "mapping": { "index": "not_analyzed" }, "match": "*", "match_mapping_type": "*" } } ], "dynamic": true, "properties": { "url": { "index": "analyzed", "type": "string" }, "resourceurl": { "index": "analyzed", "type": "string" } } } } }
overall, index-level template:
{ "mappings": { "_default_": { "dynamic_templates": [ { "base": { "mapping": { "index": "not_analyzed" }, "match": "*", "match_mapping_type": "*" } } ] } } }
Comments
Post a Comment