# Nested fields & strict dynamic mapping

**URL:** <https://discuss.elastic.co/t/nested-fields-strict-dynamic-mapping/260533>\
**Category:** Elasticsearch\
**Created:** [January 8, 2021, 11:27am UTC](https://discuss.elastic.co/t/nested-fields-strict-dynamic-mapping/260533 "2021-01-08T11:27:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![loldebyte](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@loldebyte](https://discuss.elastic.co/u/loldebyte)\
**Post date:** [January 8, 2021, 11:27am UTC](https://discuss.elastic.co/t/nested-fields-strict-dynamic-mapping/260533/1 "2021-01-08T11:27:54Z")

</div>

Hello,  
Following [this](https://stackoverflow.com/questions/65611149/why-dynamic-field-is-added-even-though-dynamic-is-set-to-strict-in-elasticsearch/65613070#65613070) stackoverlow question, i came here before opening an issue [on github](https://github.com/elastic/elasticsearch/issues).

An indice with the following mapping:

```auto
{
   "test2": {
      "mappings": {
         "dynamic": "strict",
         "properties": {
            "field1": {
               "properties": {
                  "field2": {
                     "type": "text"
}}}}}}} // collapsed

```

Accepts updates and indexes such as the following :

```auto
POST /test2/_doc/0
{
   "doc": {
      "field1.field2": "1"
}}

```

Which would be fine if the resulting document's `_source` were :

```auto
"field1": {
  "field2": "1"
}

```

But the resulting document's `_source` is :

```auto
"field1.field2": "1"

```

In other words, is seems to me that despite the `"dynamic": "strict"` mapping parameter, a new field `"field1.field2"` is added.  
It has to be noted however, that the mapping does stay exactly the same.

Edit : updating the document with different values for the `"field1.field2"` and `"field1": {"field2"}` results in different values for each.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 5, 2021, 11:28am UTC](https://discuss.elastic.co/t/nested-fields-strict-dynamic-mapping/260533/2 "2021-02-05T11:28:07Z")

</div>

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