# Static Mapping vs Dynamic Mapping when using templates

**URL:** <https://discuss.elastic.co/t/static-mapping-vs-dynamic-mapping-when-using-templates/29094>\
**Category:** Elasticsearch\
**Created:** [September 11, 2015, 7:36am UTC](https://discuss.elastic.co/t/static-mapping-vs-dynamic-mapping-when-using-templates/29094 "2015-09-11T07:36:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stam585](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@stam585](https://discuss.elastic.co/u/stam585)\
**Post date:** [September 11, 2015, 7:36am UTC](https://discuss.elastic.co/t/static-mapping-vs-dynamic-mapping-when-using-templates/29094/1 "2015-09-11T07:36:07Z")

</div>

Hi,  
I have let my system run with dynamic mapping for a while.  
It created a huge index form all of my entity data (current and history )  
Many fields that I wouldn't like to index are being index.

So, I thought to change it to static mapping.  
This way I would set only thte fields I need,  
My problem is that  
a. The index is still very big, but that's ok.  
b. In dynamic mapping a lot of definitions are now written in one place - the template (using matcher).  
In static mapping I will not be able to define it in one place.

Changing a behavior in static mapping will require me to change it in multiple places.

Is there a way to apply a template behaviour in static mapping ?  
When is it considered a good practice to use static mapping?

---

<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:** [September 11, 2015, 7:45am UTC](https://discuss.elastic.co/t/static-mapping-vs-dynamic-mapping-when-using-templates/29094/2 "2015-09-11T07:45:36Z")

</div>

This is the choice you need to make between the two.  
It'd be nice if we could use the wildcard matching with a strict template, but it's just not currently possible unfortunately.

---

<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:** [July 5, 2017, 11:50pm UTC](https://discuss.elastic.co/t/static-mapping-vs-dynamic-mapping-when-using-templates/29094/3 "2017-07-05T23:50:54Z")

</div>


