Maybe set a template in ES is helpful for you. https://www.elastic.co/guide/en/elasticsearch/reference/current/default-mapping.html
eg:
curl -XPUT 'localhost:9200/_template/all' -d '
{
"order": 0,
"template": "*",
"settings": {
"index.number_of_shards": "1"
},
"mappings": {
"_default_": {
"dynamic_templates": [
{
"string": {
"mapping": {
"index": "not_analyzed",
"type": "string"
},
"match_mapping_type": "string"
}
}
]
}
},
"aliases": {}
}
}
'
It will set all the string type field not_analyzed.