I’m creating an index that should be strict_allow_templates to avoid introduction of errors on the mapping, one of the fields should be an object representing a dictionary with IDs as key with the following json representation as example:
"dict": {
"146": "lorem ipsum dolum",
"23297030": "",
"20454962": "ipsum dolor sit amet"
}
The dictionary may have any number of “long” type keys with string values.
With this objective in mind I wrote the following dynamic template, using path_match (that I understood to be the tool for this kind of inner object scenario):
{
fields: {
mapping: {
type: 'text'
},
match_mapping_type: 'string',
path_match: 'dict.\\d{1,19}$',
}
}
but when trying to index it I get an error:
strict_dynamic_mapping_exception: [strict_dynamic_mapping_exception] Reason: mapping set to strict_allow_templates, dynamic introduction of [dict] within [_doc] is not allowed
I fear that introducing the object on the mapping properties will open the possibility for malformed objects on the document.
What would be the correct way to build a dynamic template for accepting objects with dynamic fields that follow a naming pattern?