# Using a template file in config/templates is not letting me specify a custom analyzer

**URL:** <https://discuss.elastic.co/t/using-a-template-file-in-config-templates-is-not-letting-me-specify-a-custom-analyzer/10249>\
**Category:** Elasticsearch\
**Created:** [January 7, 2013, 11:45am UTC](https://discuss.elastic.co/t/using-a-template-file-in-config-templates-is-not-letting-me-specify-a-custom-analyzer/10249 "2013-01-07T11:45:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neil\_Prosser](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/neil_prosser/32/1781_2.png) [@Neil\_Prosser](https://discuss.elastic.co/u/Neil_Prosser)\
**Post date:** [January 7, 2013, 11:45am UTC](https://discuss.elastic.co/t/using-a-template-file-in-config-templates-is-not-letting-me-specify-a-custom-analyzer/10249/1 "2013-01-07T11:45:06Z")

</div>

Hi there,

I'm attempting to use a template file on disk to provide settings for my  
indices and I'm finding that specifying a custom analyzer isn't working.

I've created a gist: [https://gist.github.com/4474368](https://gist.github.com/4474368) which gives the  
template file, the curl command, error message and log contents for the  
error. I think I've got a similar problem  
to [https://groups.google.com/d/topic/elasticsearch/DHYbvtrFNI8/discussion](https://groups.google.com/d/topic/elasticsearch/DHYbvtrFNI8/discussion)

If I POST contents of the template file (without the template definition  
etc.) the mapping and custom analyzer work as expected.

Is this a bug or have I made a mistake?

--

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [January 8, 2013, 3:28am UTC](https://discuss.elastic.co/t/using-a-template-file-in-config-templates-is-not-letting-me-specify-a-custom-analyzer/10249/2 "2013-01-08T03:28:58Z")

</div>

I am not sure why it works with POST, but in the example that you posted,  
you are missing "index" element in the "settings". Try  
this: [add\_doc.sh · GitHub](https://gist.github.com/4480925#file-template-json)

On Monday, January 7, 2013 6:45:06 AM UTC-5, Neil Prosser wrote:

> Hi there,
> 
> I'm attempting to use a template file on disk to provide settings for my  
> indices and I'm finding that specifying a custom analyzer isn't working.
> 
> I've created a gist: [Using an Elasticsearch template file from $ES\_HOME/config/templates does not allow me to specify a custom analyzer. · GitHub](https://gist.github.com/4474368) which gives the  
> template file, the curl command, error message and log contents for the  
> error. I think I've got a similar problem to  
> [https://groups.google.com/d/topic/elasticsearch/DHYbvtrFNI8/discussion](https://groups.google.com/d/topic/elasticsearch/DHYbvtrFNI8/discussion)
> 
> If I POST contents of the template file (without the template definition  
> etc.) the mapping and custom analyzer work as expected.
> 
> Is this a bug or have I made a mistake?

--

---

<div class="post-metadata">

**Author:** ![Neil\_Prosser](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/neil_prosser/32/1781_2.png) [@Neil\_Prosser](https://discuss.elastic.co/u/Neil_Prosser)\
**Post date:** [January 8, 2013, 10:09pm UTC](https://discuss.elastic.co/t/using-a-template-file-in-config-templates-is-not-letting-me-specify-a-custom-analyzer/10249/3 "2013-01-08T22:09:33Z")

</div>

Damn! I knew there'd be something stupid. I assumed that since it worked  
when I POSTed it it was all good.

Thanks for spotting that. It works as expected now.

On Tuesday, 8 January 2013 03:28:58 UTC, Igor Motov wrote:

> I am not sure why it works with POST, but in the example that you posted,  
> you are missing "index" element in the "settings". Try this:  
> [add\_doc.sh · GitHub](https://gist.github.com/4480925#file-template-json)
> 
> On Monday, January 7, 2013 6:45:06 AM UTC-5, Neil Prosser wrote:
> 
> > Hi there,
> > 
> > I'm attempting to use a template file on disk to provide settings for my  
> > indices and I'm finding that specifying a custom analyzer isn't working.
> > 
> > I've created a gist: [Using an Elasticsearch template file from $ES\_HOME/config/templates does not allow me to specify a custom analyzer. · GitHub](https://gist.github.com/4474368) which gives the  
> > template file, the curl command, error message and log contents for the  
> > error. I think I've got a similar problem to  
> > [https://groups.google.com/d/topic/elasticsearch/DHYbvtrFNI8/discussion](https://groups.google.com/d/topic/elasticsearch/DHYbvtrFNI8/discussion)
> > 
> > If I POST contents of the template file (without the template definition  
> > etc.) the mapping and custom analyzer work as expected.
> > 
> > Is this a bug or have I made a mistake?

--

---

<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, 2:57am UTC](https://discuss.elastic.co/t/using-a-template-file-in-config-templates-is-not-letting-me-specify-a-custom-analyzer/10249/4 "2017-07-06T02:57:19Z")

</div>


