# Is dynamic mapping reliable

**URL:** <https://discuss.elastic.co/t/is-dynamic-mapping-reliable/8201>\
**Category:** Elasticsearch\
**Created:** [June 23, 2012, 12:38am UTC](https://discuss.elastic.co/t/is-dynamic-mapping-reliable/8201 "2012-06-23T00:38:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarun\_Jangra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tarun_jangra/32/1426_2.png) [@Tarun\_Jangra](https://discuss.elastic.co/u/Tarun_Jangra)\
**Post date:** [June 23, 2012, 12:38am UTC](https://discuss.elastic.co/t/is-dynamic-mapping-reliable/8201/1 "2012-06-23T00:38:26Z")

</div>

Well, yeah it is reliable as far as the number of attributes are constant.  
And application is suppose to send strict data. But when we are working  
with php or such loosely typed language. I am getting not very good feeling  
about that.

Does this make sense to create mapping of all attributes manually?

Does this add any overhead on performance or could gain some performance?

---

<div class="post-metadata">

**Author:** ![Pierre\_Durand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierre_durand/32/1895_2.png) [@Pierre\_Durand](https://discuss.elastic.co/u/Pierre_Durand)\
**Post date:** [June 24, 2012, 12:16am UTC](https://discuss.elastic.co/t/is-dynamic-mapping-reliable/8201/2 "2012-06-24T00:16:43Z")

</div>

Personally, I use a non dynamic mapping.  
I use dynamic = "strict" to prevent incorrectly formatted documents

On Saturday, June 23, 2012 2:38:26 AM UTC+2, Rimpy wrote:

> Well, yeah it is reliable as far as the number of attributes are constant.  
> And application is suppose to send strict data. But when we are working  
> with php or such loosely typed language. I am getting not very good feeling  
> about that.
> 
> Does this make sense to create mapping of all attributes manually?
> 
> Does this add any overhead on performance or could gain some performance?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [June 24, 2012, 8:36am UTC](https://discuss.elastic.co/t/is-dynamic-mapping-reliable/8201/3 "2012-06-24T08:36:11Z")

</div>

Hi

I prefer a non dynamic mapping as well - at least for all important data  
types. We've already had some problems, where data was being autodetected  
and then all other data was important as a wrong type (an example might be  
a price, where the first document contains a value of 25 and mapped as an  
int whereas all other documents might be a float - yes I know that prices  
and floats are not too close friends)

Furthermore it helps developers to understand what is being indexed, even  
if they do not know about the data structure.

At the end this is a matter of personal taste and how standardized the  
formats are, which are imported into ES.

--Alexander

---

<div class="post-metadata">

**Author:** ![Tarun\_Jangra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tarun_jangra/32/1426_2.png) [@Tarun\_Jangra](https://discuss.elastic.co/u/Tarun_Jangra)\
**Post date:** [June 24, 2012, 6:26pm UTC](https://discuss.elastic.co/t/is-dynamic-mapping-reliable/8201/4 "2012-06-24T18:26:05Z")

</div>

@Pierre and @Alexander  
You are right. i've experienced such behavior and that's why now i am  
getting strict what should be type cast. And What should not. for dynamic  
types, we do not have any control what should be indexed  
and what should not. But defining mapping i can keep control on that. And  
with these settings in mind. I do find the improvement while re-indexing.  
It took me 3 hours to re-index 200K entities on a very simple  
machine having 2.5 Gz processor and 2 GB Ram. But when it was dynamic it  
took around 24 hours.

On Sunday, June 24, 2012 2:06:11 PM UTC+5:30, Alexander Reelsen wrote:

> Hi
> 
> I prefer a non dynamic mapping as well - at least for all important data  
> types. We've already had some problems, where data was being autodetected  
> and then all other data was important as a wrong type (an example might be  
> a price, where the first document contains a value of 25 and mapped as an  
> int whereas all other documents might be a float - yes I know that prices  
> and floats are not too close friends)
> 
> Furthermore it helps developers to understand what is being indexed, even  
> if they do not know about the data structure.
> 
> At the end this is a matter of personal taste and how standardized the  
> formats are, which are imported into ES.
> 
> --Alexander

---

<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 6, 2017, 3:22am UTC](https://discuss.elastic.co/t/is-dynamic-mapping-reliable/8201/5 "2017-07-06T03:22:47Z")

</div>


