# Partially dynamic mappings

**URL:** <https://discuss.elastic.co/t/partially-dynamic-mappings/254289>\
**Category:** Elasticsearch\
**Created:** [November 4, 2020, 2:37pm UTC](https://discuss.elastic.co/t/partially-dynamic-mappings/254289 "2020-11-04T14:37:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SorenAndersenCactus](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@SorenAndersenCactus](https://discuss.elastic.co/u/SorenAndersenCactus)\
**Post date:** [November 4, 2020, 2:37pm UTC](https://discuss.elastic.co/t/partially-dynamic-mappings/254289/1 "2020-11-04T14:37:22Z")

</div>

Hi there!

We have an elastic mapping that looks something like:

```auto
 "mappings": {
            "full-text-content": {
                "dynamic": "strict",
                "properties": {}
                    "doi": {
                        "type": "string",
                        "index": "not_analyzed",
                        "doc_values": True
                    },
                    "customerFacetFields": {
                        "properties": {
                            "field1": {
                                "type": "Boolean",
                                "index": "not_analyzed",
                                "doc_values": True
                            },
                            "field2": {
                                "type": "string",
                                "index": "not_analyzed",
                                "doc_values": True
                            },
                            "field3": {
                                "type": "string",
                                "index": "not_analyzed",
                                "doc_values": True
                            }
                        }
                    },
                    "customerPassthroughFields": {
                        "properties": {
                            "passthroughfield1": {
                                "type": "string"
                            },
                            "passthroughfield2": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        } 

```

As you call tell:

- We use strict mode
- There are 2 types of fields determined by the customer, depending on if it's something we want to support facetting on or not

To enable this, we've built a kind of self-service, that allows customers to define new fields (with limitations).

However, for the passthroughFields, this is seen as a bit too much bother - really, we want them to be able to put whatever they want in there, and schema be damned. On the other hand, we really don't want them to mess with the schema of customerFacetFields.

Is there any way to tell Elastic to make the whole schema "strict" BUT allow a sub-part ("customerPassthroughFields") to be dynamic?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 5, 2020, 3:28am UTC](https://discuss.elastic.co/t/partially-dynamic-mappings/254289/2 "2020-11-05T03:28:28Z")

</div>

> [@SorenAndersenCactus](#):
>
> Is there any way to tell Elastic to make the whole schema "strict" BUT allow a sub-part ("customerPassthroughFields") to be dynamic?

Nope ☹

---

<div class="post-metadata">

**Author:** ![aneeqyusuf](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@aneeqyusuf](https://discuss.elastic.co/u/aneeqyusuf)\
**Post date:** [November 5, 2020, 4:46am UTC](https://discuss.elastic.co/t/partially-dynamic-mappings/254289/3 "2020-11-05T04:46:02Z")

</div>

I guess if you enforce a mapping for the customer facet fields, Elastic will enforce that particular schema and types of those fields, but would still accept other fields in the index. Not sure if that is the case in strict-mode as well, but should get your job done.

---

<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:** [December 3, 2020, 4:46am UTC](https://discuss.elastic.co/t/partially-dynamic-mappings/254289/4 "2020-12-03T04:46:02Z")

</div>

Closed on December 3, 2020, 4:46am UTC

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