# Issue with dynamic index template with a dynamic mapping template

**URL:** <https://discuss.elastic.co/t/issue-with-dynamic-index-template-with-a-dynamic-mapping-template/6657>\
**Category:** Elasticsearch\
**Created:** [February 9, 2012, 3:37pm UTC](https://discuss.elastic.co/t/issue-with-dynamic-index-template-with-a-dynamic-mapping-template/6657 "2012-02-09T15:37:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wes\_Plunk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wes_plunk/32/2446_2.png) [@Wes\_Plunk](https://discuss.elastic.co/u/Wes_Plunk)\
**Post date:** [February 9, 2012, 3:37pm UTC](https://discuss.elastic.co/t/issue-with-dynamic-index-template-with-a-dynamic-mapping-template/6657/1 "2012-02-09T15:37:34Z")

</div>

here's the gist [https://gist.github.com/1780664](https://gist.github.com/1780664)

I've setup a index template and within that template a dynamic mapping  
template

It seems that when I add a new document with a new field the dynamically  
created field uses the dynamic mapping I've setup but some attributes don't  
get applied to the new field. The one that stands out from viewing the  
resulting config is the "index" attribute doesn't get applied. The other  
issue is that when browsing the data I don't see the new field "strField1",  
even though the field is config'd to "store" : "yes"

1. Am I misunderstanding how dynamic templates work
2. Am I doing what is necessary to allow me to view the new field or is  
there other configuration options that need to be setup
3. Am I doing what is necessary to allow me to query/index the new field or  
is there other configuration options that need to be setup

I'll be happy to provide more details withint the gist if necessary

---

<div class="post-metadata">

**Author:** ![Mohit\_Chawla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohit_chawla/32/2243_2.png) [@Mohit\_Chawla](https://discuss.elastic.co/u/Mohit_Chawla)\
**Post date:** [February 9, 2012, 5:59pm UTC](https://discuss.elastic.co/t/issue-with-dynamic-index-template-with-a-dynamic-mapping-template/6657/2 "2012-02-09T17:59:13Z")

</div>

Hello,

On Thu, Feb 9, 2012 at 9:07 PM, Wes Plunk [wes@wesandemily.com](mailto:wes@wesandemily.com) wrote:

> here's the gist

I think you are missing the 'type' you want to apply the dynamic  
templates to. If you want to apply it for all types, set it to  
_default_. I wrote a wiki entry for another project to use index  
templates & dynamic mappings few days back ( very simplistic ), which  
you can probably look at.

> **[GitHub - elastic/logstash: Logstash - transport and process your logs,...](https://github.com/elastic/logstash)**
>
> Logstash - transport and process your logs, events, or other data - GitHub - elastic/logstash: Logstash - transport and process your logs, events, or other data

---

<div class="post-metadata">

**Author:** ![Wes\_Plunk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wes_plunk/32/2446_2.png) [@Wes\_Plunk](https://discuss.elastic.co/u/Wes_Plunk)\
**Post date:** [February 9, 2012, 6:23pm UTC](https://discuss.elastic.co/t/issue-with-dynamic-index-template-with-a-dynamic-mapping-template/6657/3 "2012-02-09T18:23:31Z")

</div>

If that were the case then what's "match" and "match\_mapping\_type" for in  
my template config. I'm not having the issue that it's not matching, I'm  
having the issue that once it's matched the new field with a template it  
doesn't seem to setup the new field exactly like the template is defined.  
Proof that it actually matched correctly to the predefined template is  
there because my custom analyzer is correctly applied to the new field.

"dynamic\_templates": [  
{  
"stringMappingTemplate": {  
_"match": "_",\*

- 

```
       "match_mapping_type": "string",*
      "mapping": {
        "type": "string",
        "store": "yes",
        "index": "analyzed",
        "analyzer": "defaultAnalyzerForStringSearching"
      }
    }
  }
]
```

---

<div class="post-metadata">

**Author:** ![Wes\_Plunk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wes_plunk/32/2446_2.png) [@Wes\_Plunk](https://discuss.elastic.co/u/Wes_Plunk)\
**Post date:** [February 10, 2012, 4:29pm UTC](https://discuss.elastic.co/t/issue-with-dynamic-index-template-with-a-dynamic-mapping-template/6657/4 "2012-02-10T16:29:37Z")

</div>

I think I figured it out.

Unless I specify the field the field will not return, so the "store":"yes"  
option is definitely working.

My confusion I guess is that the "index":"analyzed" doesn't show up in the  
config for the "strField1". It is working correctly but I would have  
expected to see that the dynamically generated field would have this  
attribute.

---

<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:** [February 12, 2012, 2:20pm UTC](https://discuss.elastic.co/t/issue-with-dynamic-index-template-with-a-dynamic-mapping-template/6657/5 "2012-02-12T14:20:18Z")

</div>

It won't show index set to analyzed because its the default (to conserve space).

On Friday, February 10, 2012 at 6:29 PM, Wes Plunk wrote:

> I think I figured it out.
> 
> Unless I specify the field the field will not return, so the "store":"yes" option is definitely working.
> 
> My confusion I guess is that the "index":"analyzed" doesn't show up in the config for the "strField1". It is working correctly but I would have expected to see that the dynamically generated field would have this attribute.

---

<div class="post-metadata">

**Author:** ![Mohit\_Chawla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohit_chawla/32/2243_2.png) [@Mohit\_Chawla](https://discuss.elastic.co/u/Mohit_Chawla)\
**Post date:** [February 12, 2012, 5:35pm UTC](https://discuss.elastic.co/t/issue-with-dynamic-index-template-with-a-dynamic-mapping-template/6657/6 "2012-02-12T17:35:37Z")

</div>

Oops, sorry if I misled Wes. #til

On Sun, Feb 12, 2012 at 7:50 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> It won't show index set to analyzed because its the default (to conserve  
> space).
> 
> On Friday, February 10, 2012 at 6:29 PM, Wes Plunk wrote:
> 
> I think I figured it out.
> 
> Unless I specify the field the field will not return, so the "store":"yes"  
> option is definitely working.
> 
> My confusion I guess is that the "index":"analyzed" doesn't show up in the  
> config for the "strField1". It is working correctly but I would have  
> expected to see that the dynamically generated field would have this  
> attribute.

---

<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:39am UTC](https://discuss.elastic.co/t/issue-with-dynamic-index-template-with-a-dynamic-mapping-template/6657/7 "2017-07-06T03:39:42Z")

</div>


