# Error defining Analysis in Template

**URL:** <https://discuss.elastic.co/t/error-defining-analysis-in-template/7791>\
**Category:** Elasticsearch\
**Created:** [May 21, 2012, 8:50pm UTC](https://discuss.elastic.co/t/error-defining-analysis-in-template/7791 "2012-05-21T20:50:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Sick](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@Michael\_Sick](https://discuss.elastic.co/u/Michael_Sick)\
**Post date:** [May 21, 2012, 8:50pm UTC](https://discuss.elastic.co/t/error-defining-analysis-in-template/7791/1 "2012-05-21T20:50:56Z")

</div>

I define a custom analyzer in my template: [https://gist.github.com/2764547](https://gist.github.com/2764547)

but when I make a call to create an index based on the template:

> <https://gist.github.com/anonymous/2764559>

I get the following:

$ ./create\_business\_location\_index.sh  
{"error":"MapperParsingException[mapping [location]]; nested:  
MapperParsingExcep  
tion[Analyzer [skedulerAnalyzer1] not found for field  
[business\_location-name]];  
","status":400}

Should this work? If so, am I configuring it correctly?

(Comments on the custom analysis welcome but be warned, it might not be  
sensible as I'm just starting to play around with it)

Thanks!

## Michael Sick

---

<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 23, 2012, 10:48pm UTC](https://discuss.elastic.co/t/error-defining-analysis-in-template/7791/2 "2012-05-23T22:48:36Z")

</div>

The analysis section should go under settings, it should work then...

On Mon, May 21, 2012 at 10:50 PM, Michael Sick \<  
[michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)\> wrote:

> I define a custom analyzer in my template:  
> [ElasticSearch Template with Analysis · GitHub](https://gist.github.com/2764547)
> 
> but when I make a call to create an index based on the template:  
> [Creating an index from the template · GitHub](https://gist.github.com/2764559)
> 
> I get the following:
> 
> $ ./create\_business\_location\_index.sh  
> {"error":"MapperParsingException[mapping [location]]; nested:  
> MapperParsingExcep  
> tion[Analyzer [skedulerAnalyzer1] not found for field  
> [business\_location-name]];  
> ","status":400}
> 
> Should this work? If so, am I configuring it correctly?
> 
> (Comments on the custom analysis welcome but be warned, it might not be  
> sensible as I'm just starting to play around with it)
> 
> Thanks!
> 
> Michael Sick
> 
> * * *

---

<div class="post-metadata">

**Author:** ![Michael\_Sick](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@Michael\_Sick](https://discuss.elastic.co/u/Michael_Sick)\
**Post date:** [May 23, 2012, 11:23pm UTC](https://discuss.elastic.co/t/error-defining-analysis-in-template/7791/3 "2012-05-23T23:23:36Z")

</div>

Thanks Shay! Will test.

On Wed, May 23, 2012 at 6:48 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> The analysis section should go under settings, it should work then...
> 
> On Mon, May 21, 2012 at 10:50 PM, Michael Sick \<  
> [michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)\> wrote:
> 
> > I define a custom analyzer in my template:  
> > [ElasticSearch Template with Analysis · GitHub](https://gist.github.com/2764547)
> > 
> > but when I make a call to create an index based on the template:  
> > [Creating an index from the template · GitHub](https://gist.github.com/2764559)
> > 
> > I get the following:
> > 
> > $ ./create\_business\_location\_index.sh  
> > {"error":"MapperParsingException[mapping [location]]; nested:  
> > MapperParsingExcep  
> > tion[Analyzer [skedulerAnalyzer1] not found for field  
> > [business\_location-name]];  
> > ","status":400}
> > 
> > Should this work? If so, am I configuring it correctly?
> > 
> > (Comments on the custom analysis welcome but be warned, it might not be  
> > sensible as I'm just starting to play around with it)
> > 
> > Thanks!
> > 
> > Michael Sick
> > 
> > * * *

---

<div class="post-metadata">

**Author:** ![annie\_xia](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@annie\_xia](https://discuss.elastic.co/u/annie_xia)\
**Post date:** [July 1, 2013, 9:36pm UTC](https://discuss.elastic.co/t/error-defining-analysis-in-template/7791/4 "2013-07-01T21:36:43Z")

</div>

hi

# I created a template like

{  
"template\_1": {  
"template": "temp\*",  
"settings": {  
"analysis": {  
"filter": {  
"gram\_stemmer": {  
"type": "stemmer",  
"name": "english"  
}  
},  
"analyzer": {  
"auto\_analyzer": {  
"type": "pattern",  
"pattern": "[{}()|\]+",  
"filter": "lowercase"  
}  
}  
}  
},  
"mappings": {  
"type1": {  
"properties": {  
"sources": {  
"type": "string",  
"analyzer": "auto\_analyzer"  
}  
}  
}  
}  
}  
}

===================================================  
but when I entered  
$ curl -XPUT localhost:9200/temp1

I still got  
"error":"MapperParsingException[mapping [type1]]; nested: MapperParsingException  
Analyzer [auto\_analyzer] not found for field [sources]]; ","status":400}

Did I have sth wrong? Thanks very much

---

<div class="post-metadata">

**Author:** ![slimdrive](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@slimdrive](https://discuss.elastic.co/u/slimdrive)\
**Post date:** [July 2, 2013, 10:12pm UTC](https://discuss.elastic.co/t/error-defining-analysis-in-template/7791/5 "2013-07-02T22:12:33Z")

</div>

Ran into the same problem today. The solution is you're missing the "index" between the "setting" and the "analysis".

So the json should be:

template\_1": {  
"template": "temp\*",  
"settings": {  
**"index" : {**  
"analysis": {

I found the answer in this thread: [https://groups.google.com/forum/#!searchin/elasticsearch/index$20template$20mapping$20analyzer$20not$20found/elasticsearch/X\_YRiaV6zLg/7967m7AOEGQJ](https://groups.google.com/forum/#!searchin/elasticsearch/index%2420template%2420mapping%2420analyzer%2420not%2420found/elasticsearch/X_YRiaV6zLg/7967m7AOEGQJ)

---

<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:28am UTC](https://discuss.elastic.co/t/error-defining-analysis-in-template/7791/6 "2017-07-06T02:28:35Z")

</div>


