# Experiencing problems using root object dynamic template mappings

**URL:** <https://discuss.elastic.co/t/experiencing-problems-using-root-object-dynamic-template-mappings/4393>\
**Category:** Elasticsearch\
**Created:** [May 12, 2011, 6:50pm UTC](https://discuss.elastic.co/t/experiencing-problems-using-root-object-dynamic-template-mappings/4393 "2011-05-12T18:50:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ellery\_Crane\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ellery_crane_2/32/3369_2.png) [@Ellery\_Crane\_2](https://discuss.elastic.co/u/Ellery_Crane_2)\
**Post date:** [May 12, 2011, 6:50pm UTC](https://discuss.elastic.co/t/experiencing-problems-using-root-object-dynamic-template-mappings/4393/1 "2011-05-12T18:50:22Z")

</div>

I'm trying to make use of dynamic templates in my mappings, but there  
seems to be a problem when I do so. Curls to duplicate can be found  
here: [https://gist.github.com/969178](https://gist.github.com/969178)

I want to set up a mapping for all "name" fields that appear inside of  
the "contact" type. (In the example curls, there is just one such  
field- the goal would be to support many nested name objects within my  
document.) If I specify the mapping manually, it works exactly as  
intended. If, however, I use a dynamic template to define the  
mappings, it appears as though it ignores the resulting analyzer  
rules. I have done a diff on the mapping both with and without the  
dynamic templates, and the only difference between them is the  
inclusion of the dynamic\_templates property itself. Yet, strangely, I  
experience different behavior when I query the same document.

Am I doing something wrong? Or is this a bug?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 13, 2011, 11:51am UTC](https://discuss.elastic.co/t/experiencing-problems-using-root-object-dynamic-template-mappings/4393/2 "2011-05-13T11:51:49Z")

</div>

Heya,

Thanks for the great repro, its a bug. Opened an issue, a fix is in the oven. [Mapping: dynamic templates of object type do not initialize some mapping data structures (like analyzers lookup) · Issue #929 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/929).  
On Thursday, May 12, 2011 at 9:50 PM, Ellery Crane wrote:

> I'm trying to make use of dynamic templates in my mappings, but there  
> seems to be a problem when I do so. Curls to duplicate can be found  
> here: [elasticsearch dynamic templates issue · GitHub](https://gist.github.com/969178)
> 
> I want to set up a mapping for all "name" fields that appear inside of  
> the "contact" type. (In the example curls, there is just one such  
> field- the goal would be to support many nested name objects within my  
> document.) If I specify the mapping manually, it works exactly as  
> intended. If, however, I use a dynamic template to define the  
> mappings, it appears as though it ignores the resulting analyzer  
> rules. I have done a diff on the mapping both with and without the  
> dynamic templates, and the only difference between them is the  
> inclusion of the dynamic\_templates property itself. Yet, strangely, I  
> experience different behavior when I query the same document.
> 
> Am I doing something wrong? Or is this a bug?

---

<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, 4:06am UTC](https://discuss.elastic.co/t/experiencing-problems-using-root-object-dynamic-template-mappings/4393/3 "2017-07-06T04:06:18Z")

</div>


