Dynamic value in index mappings override dynamic value setted in dynamic template [ES 7.6.2]

Hello,
I created a dynamic template to avoid adding specific new fields that have object type ( that match a particular pattern ) in the index mapping ( without touching the _source ). This is the body of my query :

> {
>     "dynamic_templates": [
>         {
>             "myTemplate": {
>                 "path_match": "value1.value2.*",
>                 "match_pattern": "regex",
>                 "match": "[a-zA-Z0-9]",
>                 "match_mapping_type": "object",
>                 "mapping": {
>                     "dynamic": false
>                 }
>             }
>         }
>     ]
> }

When, I insert a document, I see that the field was added to the mapping.....
Then, I setted the property "dynamic" in my index mappings to false and still got my dynamic template, and it works like magic : The field was not added when I inserted the same document.

  "mappings": {

        "dynamic": "false",
        "dynamic_templates": [ .....],
      ......

I know that the default value of dynamic mappings is true, so probably it overrides the dynamic value of my dynamic template, and I am wonderin how can we avoid this override and give the privelege to the dynamic template to manage its property on its concerned fields.

Otherwise, if my understanding is wrong, please give me an explanation about what happend between the dynamic value of the mappings and the one from the dynamic template.

Have a nice day.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.