# Dynamic mapping types

**URL:** <https://discuss.elastic.co/t/dynamic-mapping-types/142388>\
**Category:** Elasticsearch\
**Created:** [July 31, 2018, 2:30pm UTC](https://discuss.elastic.co/t/dynamic-mapping-types/142388 "2018-07-31T14:30:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![falcoagustin](https://avatars.discourse-cdn.com/v4/letter/f/db5fbb/32.png) [@falcoagustin](https://discuss.elastic.co/u/falcoagustin)\
**Post date:** [July 31, 2018, 2:30pm UTC](https://discuss.elastic.co/t/dynamic-mapping-types/142388/1 "2018-07-31T14:30:27Z")

</div>

Greetings,  
I am new here, using Elasticsearch 6.3, and I am facing the following problem when aiming to migrate 10GB of data. What I want to achieve, is to save all data its being sent, but only be able to searchable for the \*\_s fields.  
When saving data without strict mode, it caused my mapping to grow enormously, one mapping per new value added, so I assume it will eventually cause a mapping explosion.  
As a small example of my mapping is as follows:

> ```
> {
> "mappings" : {
> "_doc" : {
> "dynamic": "strict",
> "dynamic_templates" : [
> {
> "template_s" : {
> "match" : "*_s",
> "match_mapping_type" : "string",
> "mapping" : { "type" : "text", "store" : true }
> }
> },
> {
> "template_" : {
> "match" : "*",
> "match_mapping_type" : "object",
> "mapping" : { "type" : "string", "store": true, "enabled": false }
> }
> }]
> }
> }
> }
> 
> ```

On the other hand, this is a sample of the data being sent, on the one I am experiencing an error, `mapping set to strict, dynamic introduction of [data_s] within [_doc] is not allowed` is:

> ```
> {"index":{"_id": "0131d3d0-3837-4fa8-a893-12d0521f1727"}}
> {"data_s": "value", "settings":{"type":"github"}}
> 
> ```

I've also tried with `match_mapping_type` on string in the "catch all" and strings|text on mapping and all of their derivates.  
In conclusion, how do I make a mapping that uses all \_s fields for search, and excludes the other ones by only saving them without making an enormous mapping? They can be Objects and Objects inside objetcs so my mapping will get very big.

On a side note, maybe the mapping growing enormously is not a concern, just to have an idea, when I saved 15 values my mapping growed to 2k lines, so I imagine this will be a problem when migrating everything, is this correct?

Much appreciated! Thank you for your patience.

---

<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:** [August 28, 2018, 2:30pm UTC](https://discuss.elastic.co/t/dynamic-mapping-types/142388/2 "2018-08-28T14:30:31Z")

</div>

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