# Default analyzer when the given analyzer not found?

**URL:** <https://discuss.elastic.co/t/default-analyzer-when-the-given-analyzer-not-found/11300>\
**Category:** Elasticsearch\
**Created:** [March 25, 2013, 5:48pm UTC](https://discuss.elastic.co/t/default-analyzer-when-the-given-analyzer-not-found/11300 "2013-03-25T17:48:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Han\_2](https://avatars.discourse-cdn.com/v4/letter/h/7bcc69/32.png) [@Han\_2](https://discuss.elastic.co/u/Han_2)\
**Post date:** [March 25, 2013, 5:48pm UTC](https://discuss.elastic.co/t/default-analyzer-when-the-given-analyzer-not-found/11300/1 "2013-03-25T17:48:32Z")

</div>

I have an index with analyzer settings as shown below..

{  
"settings": {  
"analysis": {  
"analyzer": {  
"default": { "type": "english" },  
"ar": { "type": "arabic" },  
"hy":{ "type": "armenian" },  
...  
}  
}  
}  
}

and a type mapping as shown below

{  
"type1" : {  
"\_analyzer" : {  
"path" : "language"  
},  
"properties" : {  
"id" : { "type" : "string", "index" : "not\_analyzed" },  
"name" : { "type" : "string" },  
"language" : { "type" : "string", "index" : "not\_analyzed" }  
}  
}  
}

Language can be any language and it might not have a valid anlyzer mapping  
too... so my question is "is there anyway we can specify settings such that  
ElasticSearch uses 'default' analyzer when there is no matching analyzer  
found?" currently i am getting "No analyzer found" error message..

I could actually list out all of the languages and define an analyzer for  
each of them but in our case the language list keep changing... it would  
nice to have to have a default analyzer when there is NO matching analyzer.

I would really appreciate any suggestions.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [March 26, 2013, 2:57pm UTC](https://discuss.elastic.co/t/default-analyzer-when-the-given-analyzer-not-found/11300/2 "2013-03-26T14:57:24Z")

</div>

That sounds like a useful feature. I would suggest creating an issue for  
it.

On Monday, March 25, 2013 1:48:32 PM UTC-4, Han wrote:

> I have an index with analyzer settings as shown below..
> 
> {  
> "settings": {  
> "analysis": {  
> "analyzer": {  
> "default": { "type": "english" },  
> "ar": { "type": "arabic" },  
> "hy":{ "type": "armenian" },  
> ...  
> }  
> }  
> }  
> }
> 
> and a type mapping as shown below
> 
> {  
> "type1" : {  
> "\_analyzer" : {  
> "path" : "language"  
> },  
> "properties" : {  
> "id" : { "type" : "string", "index" : "not\_analyzed" },  
> "name" : { "type" : "string" },  
> "language" : { "type" : "string", "index" : "not\_analyzed" }  
> }  
> }  
> }
> 
> Language can be any language and it might not have a valid anlyzer mapping  
> too... so my question is "is there anyway we can specify settings such that  
> Elasticsearch uses 'default' analyzer when there is no matching analyzer  
> found?" currently i am getting "No analyzer found" error message..
> 
> I could actually list out all of the languages and define an analyzer for  
> each of them but in our case the language list keep changing... it would  
> nice to have to have a default analyzer when there is NO matching analyzer.
> 
> I would really appreciate any suggestions.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Frederic\_Meyer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frederic_meyer/32/1777_2.png) [@Frederic\_Meyer](https://discuss.elastic.co/u/Frederic_Meyer)\
**Post date:** [February 25, 2014, 1:57pm UTC](https://discuss.elastic.co/t/default-analyzer-when-the-given-analyzer-not-found/11300/3 "2014-02-25T13:57:30Z")

</div>

Hey there.

Nearly one year after this initial post, I'm running into the exact same  
issue, even though ES is now released (1.0).

Has anybody found a proper solution within ES? I've spent like 1 hour  
searching for this, without any luck.

The only ugly workaround that I can think of right now is deal with a fall  
back language at the data level i.e. before sending documents to be indexed  
by ES.

Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ee9e7c0d-8022-4c35-bdde-4e194be1da98%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ee9e7c0d-8022-4c35-bdde-4e194be1da98%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![brian\_yoder](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@brian\_yoder](https://discuss.elastic.co/u/brian_yoder)\
**Post date:** [February 25, 2014, 4:09pm UTC](https://discuss.elastic.co/t/default-analyzer-when-the-given-analyzer-not-found/11300/4 "2014-02-25T16:09:43Z")

</div>

Based on posts to this newsgroup early on in my usage of ES (over a year  
now!), I used to put the following in my elasticsearch.yml file. Any field  
that was not explicitly assigned an analyzer and that was deemed by ES to  
be a string would pick up English snowball analyzer with no stop words (my  
preference at the time):

index:  
analysis:  
analyzer:  
# set stemming analyzer with no stop words as the default  
default:  
type: snowball  
language: English  
stopwords: _none_  
filter:  
stopWordsFilter:  
type: stop  
stopwords: _none_

But since then, I've long abandoned this default approach. Instead, I  
explicitly assigned an analyzer to each and every field (you know, like a  
real database!). And then my elasticsearch.yml file now contains the  
following:

# Do not automatically create an index when a document is loaded, and do

# not automatically index unknown (unmapped) fields:

action.auto\_create\_index: false  
index.mapper.dynamic: false

Therefore, I cannot automatically create an index during a load (which  
would then create a useless index without any of the analyzers and mappings  
I've carefully crafted). And I cannot get ES to automatically create a new  
field; this is very helpful when someone uses a low-level tool such as  
curl, and misspells a field name; ES will no longer create, for example,  
the givveName field when it should have been givenName.

Brian

On Tuesday, February 25, 2014 8:57:30 AM UTC-5, Frederic Meyer wrote:

> Hey there.
> 
> Nearly one year after this initial post, I'm running into the exact same  
> issue, even though ES is now released (1.0).
> 
> Has anybody found a proper solution within ES? I've spent like 1 hour  
> searching for this, without any luck.
> 
> The only ugly workaround that I can think of right now is deal with a fall  
> back language at the data level i.e. before sending documents to be indexed  
> by ES.
> 
> Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/2f1dbdc3-299a-46fa-855f-a34c74497c43%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2f1dbdc3-299a-46fa-855f-a34c74497c43%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Frederic\_Meyer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frederic_meyer/32/1777_2.png) [@Frederic\_Meyer](https://discuss.elastic.co/u/Frederic_Meyer)\
**Post date:** [February 25, 2014, 4:19pm UTC](https://discuss.elastic.co/t/default-analyzer-when-the-given-analyzer-not-found/11300/5 "2014-02-25T16:19:31Z")

</div>

Ah yes, via the default in the yaml configuration file, of course. I'll  
give that a try, thanks!

It is a pity though that the "default" analyzer doesn't seem to do his job  
of processing all unmatched document as far as the \_analyze field is  
concerned.

Thanks  
Fred

P.S. : I do understand your position about not indexing documents for which  
you haven't craft a dedicated analyzer yet. Makes real sense.

On Tuesday, February 25, 2014 5:09:43 PM UTC+1, InquiringMind wrote:

> Based on posts to this newsgroup early on in my usage of ES (over a year  
> now!), I used to put the following in my elasticsearch.yml file. Any field  
> that was not explicitly assigned an analyzer and that was deemed by ES to  
> be a string would pick up English snowball analyzer with no stop words (my  
> preference at the time):
> 
> index:  
> analysis:  
> analyzer:  
> # set stemming analyzer with no stop words as the default  
> default:  
> type: snowball  
> language: English  
> stopwords: _none_  
> filter:  
> stopWordsFilter:  
> type: stop  
> stopwords: _none_
> 
> But since then, I've long abandoned this default approach. Instead, I  
> explicitly assigned an analyzer to each and every field (you know, like a  
> real database!). And then my elasticsearch.yml file now contains the  
> following:
> 
> # Do not automatically create an index when a document is loaded, and do
> 
> # not automatically index unknown (unmapped) fields:
> 
> action.auto\_create\_index: false  
> index.mapper.dynamic: false
> 
> Therefore, I cannot automatically create an index during a load (which  
> would then create a useless index without any of the analyzers and mappings  
> I've carefully crafted). And I cannot get ES to automatically create a new  
> field; this is very helpful when someone uses a low-level tool such as  
> curl, and misspells a field name; ES will no longer create, for example,  
> the givveName field when it should have been givenName.
> 
> Brian
> 
> On Tuesday, February 25, 2014 8:57:30 AM UTC-5, Frederic Meyer wrote:
> 
> > Hey there.
> > 
> > Nearly one year after this initial post, I'm running into the exact same  
> > issue, even though ES is now released (1.0).
> > 
> > Has anybody found a proper solution within ES? I've spent like 1 hour  
> > searching for this, without any luck.
> > 
> > The only ugly workaround that I can think of right now is deal with a  
> > fall back language at the data level i.e. before sending documents to be  
> > indexed by ES.
> > 
> > Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a0fdb30b-d63a-4679-899a-36b45c788d8d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a0fdb30b-d63a-4679-899a-36b45c788d8d%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 1:47am UTC](https://discuss.elastic.co/t/default-analyzer-when-the-given-analyzer-not-found/11300/6 "2017-07-06T01:47:21Z")

</div>


