Let's say I have the following mapping:
{
"mappings": {
"_doc": {
"properties": {
"id": {"type": "keyword"},
"params": {
"type": "object",
},
}
}
}
}
params
has a lot of fields with numeric and textual values. I don't want to specify all the fields of it but I would like to specify that all the text fields should be of keyword
type instead of text
which is the default and is analysed (which I want to avoid).
How can I do this? I'm using ElasticSearch 6.7
Adding to what @banuj mentioned:
It seems that it is possible to combine match_mapping_type
and path_match
to achieve what I wanted.
PUT my_index
{
"mappings": {
"_doc": {
"dynamic_templates": [
{
"keyword params": {
"mapping": {
"type": "keyword"
},
"match_mapping_type": "string",
"path_match": "params.*"
}
}
]
}
}
}