# Setting up default analyzer using elasticsearch.yml

**URL:** <https://discuss.elastic.co/t/setting-up-default-analyzer-using-elasticsearch-yml/10278>\
**Category:** Elasticsearch\
**Created:** [January 9, 2013, 11:03am UTC](https://discuss.elastic.co/t/setting-up-default-analyzer-using-elasticsearch-yml/10278 "2013-01-09T11:03:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_Norwood](https://avatars.discourse-cdn.com/v4/letter/p/ecd19e/32.png) [@Patrick\_Norwood](https://discuss.elastic.co/u/Patrick_Norwood)\
**Post date:** [January 9, 2013, 11:03am UTC](https://discuss.elastic.co/t/setting-up-default-analyzer-using-elasticsearch-yml/10278/1 "2013-01-09T11:03:30Z")

</div>

Hi guys,

while setting up my elasticsearch I have encountered a problem setting up  
the default index and default search analyzer. I want these analyzers to be  
used for all indexed data (I am using Tire gem for Ruby on Rails), so I  
guess that all I have to do is configure the elasticsearch.yml correctly.  
This is what I have so far:

index:  
analysis:  
analyzer:  
default\_index:  
type: custom  
tokenizer: whitespace  
filter: [word\_delimiter, standard, lowercase, synonym,  
edgeNGram]  
default\_search:  
type: custom  
tokenizer: whitespace  
filter: [word\_delimiter, standard, lowercase, synonym]

However, this analyzer does not seem to be applied while using the search  
in my application. All other settings are set to default.  
Any suggestions/corrections will be much appreciated. Thanks in advance.

PN

--

---

<div class="post-metadata">

**Author:** ![Patrick\_Norwood](https://avatars.discourse-cdn.com/v4/letter/p/ecd19e/32.png) [@Patrick\_Norwood](https://discuss.elastic.co/u/Patrick_Norwood)\
**Post date:** [January 9, 2013, 5:47pm UTC](https://discuss.elastic.co/t/setting-up-default-analyzer-using-elasticsearch-yml/10278/2 "2013-01-09T17:47:45Z")

</div>

no hints?

--

---

<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 9, 2013, 6:14pm UTC](https://discuss.elastic.co/t/setting-up-default-analyzer-using-elasticsearch-yml/10278/3 "2013-01-09T18:14:55Z")

</div>

Where are synonym and edgeNGram filters defined?  
Do you see any errors in the log file when you start elasticsearch?  
Did you reindex all records after changing the analyzer?  
Did you try using \_analyze command to see if your analyzer is having effect?

On Wednesday, January 9, 2013 12:47:45 PM UTC-5, Patrick Norwood wrote:

> no hints?

--

---

<div class="post-metadata">

**Author:** ![Patrick\_Norwood](https://avatars.discourse-cdn.com/v4/letter/p/ecd19e/32.png) [@Patrick\_Norwood](https://discuss.elastic.co/u/Patrick_Norwood)\
**Post date:** [January 9, 2013, 7:36pm UTC](https://discuss.elastic.co/t/setting-up-default-analyzer-using-elasticsearch-yml/10278/4 "2013-01-09T19:36:38Z")

</div>

1. I was thinking that perhaps default settings would be applied so I did  
not define those filters, anyway, I left out synonym filter (don't need it  
for now) and the actual elasticsearch.yml looks like this:

index :  
analysis :  
analyzer :  
default\_index :  
type : custom  
tokenizer : whitespace  
filter : [word\_delimiter, standard, lowercase, edgeNGram]  
default\_search :  
type : custom  
tokenizer : whitespace  
filter : [word\_delimiter, standard, lowercase]  
filter :  
edgeNGram :  
type : edgeNGram  
min\_gram : 2  
max\_gram : 15  
side : front

1. I don't see any errors after starting elasticsearch in the log file or  
console (running it with -f).

2. I don't know whether I am doing reindexing right, I simply delete  
indexes, restart the server, and create indexes again using rails console  
and som Tire commands.

3. I was playing with analyze API for quite some time, but I don't seem to  
get the right results, it seems that my analyzer does not have effect, or  
is not being loaded or I just don't know how to us analyze API :).  
Basically I tried it this way:

Probably wrong approach, because analyzer default\_search or default\_index  
were not found (might this indicate they are not being loaded from .yml??):  
curl -XGET 'localhost:9200/\_analyze?analyzer=default\_search' -d 'testing  
string'  
curl -XGET 'localhost:9200/\_analyze?analyzer=default\_index' -d 'testing  
string'

Then I tried it like this, and it seemed to have used the standard analyzer.  
curl -XGET 'localhost:9200/\_analyze?analyzer=default' -d 'testing string'

I really don't know what I might be possibly doing wrong :).

On Wednesday, January 9, 2013 7:14:55 PM UTC+1, Igor Motov wrote:

> Where are synonym and edgeNGram filters defined?  
> Do you see any errors in the log file when you start elasticsearch?  
> Did you reindex all records after changing the analyzer?  
> Did you try using \_analyze command to see if your analyzer is having  
> effect?
> 
> On Wednesday, January 9, 2013 12:47:45 PM UTC-5, Patrick Norwood wrote:
> 
> > no hints?

--

---

<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 9, 2013, 9:15pm UTC](https://discuss.elastic.co/t/setting-up-default-analyzer-using-elasticsearch-yml/10278/5 "2013-01-09T21:15:58Z")

</div>

1. This is strange because the mapping in 1. is wrong (filter: has wrong  
indentation, it has to be on the same level as analyzer), if you are  
editing correct config file, elasticsearch should fail to start.

2. That should be fine

3. As Clinton mentioned on IRC channel you need to specify an index.

On Wednesday, January 9, 2013 2:36:38 PM UTC-5, Patrick Norwood wrote:

> 1. I was thinking that perhaps default settings would be applied so I did  
> not define those filters, anyway, I left out synonym filter (don't need it  
> for now) and the actual elasticsearch.yml looks like this:
> 
> index :  
> analysis :  
> analyzer :  
> default\_index :  
> type : custom  
> tokenizer : whitespace  
> filter : [word\_delimiter, standard, lowercase, edgeNGram]  
> default\_search :  
> type : custom  
> tokenizer : whitespace  
> filter : [word\_delimiter, standard, lowercase]  
> filter :  
> edgeNGram :  
> type : edgeNGram  
> min\_gram : 2  
> max\_gram : 15  
> side : front
> 
> 1. I don't see any errors after starting elasticsearch in the log file or  
> console (running it with -f).
> 
> 2. I don't know whether I am doing reindexing right, I simply delete  
> indexes, restart the server, and create indexes again using rails console  
> and som Tire commands.
> 
> 3. I was playing with analyze API for quite some time, but I don't seem to  
> get the right results, it seems that my analyzer does not have effect, or  
> is not being loaded or I just don't know how to us analyze API :).  
> Basically I tried it this way:
> 
> Probably wrong approach, because analyzer default\_search or default\_index  
> were not found (might this indicate they are not being loaded from .yml??):  
> curl -XGET 'localhost:9200/\_analyze?analyzer=default\_search' -d 'testing  
> string'  
> curl -XGET 'localhost:9200/\_analyze?analyzer=default\_index' -d 'testing  
> string'
> 
> Then I tried it like this, and it seemed to have used the standard  
> analyzer.  
> curl -XGET 'localhost:9200/\_analyze?analyzer=default' -d 'testing string'
> 
> I really don't know what I might be possibly doing wrong :).
> 
> On Wednesday, January 9, 2013 7:14:55 PM UTC+1, Igor Motov wrote:
> 
> > Where are synonym and edgeNGram filters defined?  
> > Do you see any errors in the log file when you start elasticsearch?  
> > Did you reindex all records after changing the analyzer?  
> > Did you try using \_analyze command to see if your analyzer is having  
> > effect?
> > 
> > On Wednesday, January 9, 2013 12:47:45 PM UTC-5, Patrick Norwood wrote:
> > 
> > > no hints?

--

---

<div class="post-metadata">

**Author:** ![Patrick\_Norwood](https://avatars.discourse-cdn.com/v4/letter/p/ecd19e/32.png) [@Patrick\_Norwood](https://discuss.elastic.co/u/Patrick_Norwood)\
**Post date:** [January 10, 2013, 12:23pm UTC](https://discuss.elastic.co/t/setting-up-default-analyzer-using-elasticsearch-yml/10278/6 "2013-01-10T12:23:48Z")

</div>

Thanks a lot Igor, your feedback helped me solve this issue. The main  
problem was indentation, how embarrassing :).

--

---

<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/setting-up-default-analyzer-using-elasticsearch-yml/10278/7 "2017-07-06T02:57:01Z")

</div>


