I am indexing data (using Elasticsearch 5.2.x) where I don't know in advance the set of all fields in my records. Since the number of fields is unbounded, I want to disable dynamic mapping of those fields. However, I would like to use dynamic templates to selectively index certain fields (via copy_to
). It seems as though if I use "enabled": false
to ensure that my object isn't dynamically mapped, then the dynamic template doesn't actually work (ie. none of the object's fields get copied into the copy_to
field.)
Here is my current mapping:
{
"dynamic": "strict",
"dynamic_templates": [
{
"row_fts": {
"match_mapping_type": "string",
"path_match": "data.*",
"mapping": { "type": "text", "copy_to": "row_fts" }
}
}
],
"properties": {
"row_id": { "type": "long" },
"row_type": { "type": "keyword" },
"row_fts": { "type": "text", "analyzer": "standard" },
"data": {
"type": "object",
"dynamic": true,
"enabled": false
}
}
}
Is there a way to achieve this? Thanks for your help!