Yes, you can achieve this by creating an index template on *
with a _default_
mapping type and dynamic templates
curl -XPUT localhost:9200/_template/global -d '{
"template": "*",
"mappings": {
"_default_": {
"dynamic_templates": [
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "string",
"index": "not_analyzed"
}
}
}
]
}
}
}'
Then you can create any document in any new index and the all string fields will be not_analyzed
curl -XPUT localhost:9200/dummy_index/dummy_type/1 -d '{"name": "dummy"}'
If you check the dummy_type
mapping type of the newly created dummy_index
, you'll see that the name
field will be not_analyzed