# Index configuration

**URL:** <https://discuss.elastic.co/t/index-configuration/4491>\
**Category:** Elasticsearch\
**Created:** [May 27, 2011, 10:21pm UTC](https://discuss.elastic.co/t/index-configuration/4491 "2011-05-27T22:21:38Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yannick](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yannick/32/3218_2.png) [@Yannick](https://discuss.elastic.co/u/Yannick)\
**Post date:** [May 27, 2011, 10:21pm UTC](https://discuss.elastic.co/t/index-configuration/4491/1 "2011-05-27T22:21:38Z")

</div>

I'm trying to set a default index configuration in config/elastisearch.yml but for some reason it doesn't seem to get picked up. Can somebody spot the error?  
The ES doesn't seem to show an error when loading. Here is the yml:

index:  
analysis:  
analyzer:  
default\_index:  
tokenizer: standard  
filter: [standard, lowercase, my\_synonym, my\_snow]  
default\_search:  
tokenizer: standard  
filter: [standard, lowercase, stop]  
filter:  
my\_synonym:  
type: synonym  
synonyms\_path: 'analysers/synonyms.dat'  
ignore\_case: true  
my\_snow:  
type: snowball  
language: English

---

<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 28, 2011, 9:19am UTC](https://discuss.elastic.co/t/index-configuration/4491/2 "2011-05-28T09:19:55Z")

</div>

After you create the index, can you execute a get settings on it and see if it was applied to not?[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html).

On Saturday, May 28, 2011 at 1:21 AM, Yannick Smits wrote:

> I’m trying to set a default index configuration in config/elastisearch.yml but for some reason it doesn’t seem to get picked up. Can somebody spot the error?  
> The ES doesn’t seem to show an error when loading. Here is the yml:
> 
> index:  
> analysis:  
> analyzer:  
> default\_index:  
> tokenizer: standard  
> filter: [standard, lowercase, my\_synonym, my\_snow]  
> default\_search:  
> tokenizer: standard  
> filter: [standard, lowercase, stop]  
> filter:  
> my\_synonym:  
> type: synonym  
> synonyms\_path: 'analysers/synonyms.dat'  
> ignore\_case: true  
> my\_snow:  
> type: snowball  
> language: English

---

<div class="post-metadata">

**Author:** ![David\_Pilato](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@David\_Pilato](https://discuss.elastic.co/u/David_Pilato)\
**Post date:** [May 28, 2011, 10:06am UTC](https://discuss.elastic.co/t/index-configuration/4491/3 "2011-05-28T10:06:26Z")

</div>

Hi Yannick,

Something I found using ES.

If you have already indexed one document (with default mapping or not),  
config files won't be read by ES.  
So, to use mapping within config file, you have to start a clean ES cluster  
with the config files put in mappings/indexName/typeName.json

Yo can also have a look at this discussion thread :  
[http://elasticsearch-users.115913.n3.nabble.com/id-and-mappings-tp2973448p2980327.html](http://elasticsearch-users.115913.n3.nabble.com/id-and-mappings-tp2973448p2980327.html)

Hope this helps  
David

Le , Yannick Smits [yannick@goyaweb.nl](mailto:yannick@goyaweb.nl) a écrit :

> I'm trying to set a default index configuration in  
> config/elastisearch.yml but for some reason it doesn't seem to get picked  
> up. Can somebody spot the error?The ES doesn't seem to show an error when  
> loading. Here is the yml: index: analysis: analyzer: default\_index:  
> tokenizer: standard filter: [standard, lowercase, my\_synonym, my\_snow]  
> default\_search: tokenizer: standard filter: [standard, lowercase, stop]  
> filter: my\_synonym: type: synonym synonyms\_path: 'analysers/synonyms.dat'  
> ignore\_case: true my\_snow: type: snowball language: English

---

<div class="post-metadata">

**Author:** ![dpilato](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dpilato/32/2449_2.png) [@dpilato](https://discuss.elastic.co/u/dpilato)\
**Post date:** [May 28, 2011, 10:54am UTC](https://discuss.elastic.co/t/index-configuration/4491/4 "2011-05-28T10:54:27Z")

</div>

Hi Yannick,

Something I found using ES.

If you have already indexed one document (with default mapping or not),  
config files won't be read by ES.  
So, to use mapping within config file, you have to start a clean ES cluster  
with the config files put in mappings/indexName/typeName.json

Yo can also have a look at this discussion thread :  
[http://elasticsearch-users.115913.n3.nabble.com/id-and-mappings-tp2973448p2980327.html](http://elasticsearch-users.115913.n3.nabble.com/id-and-mappings-tp2973448p2980327.html)

Hope this helps  
David

2011/5/28 Yannick Smits [yannick@goyaweb.nl](mailto:yannick@goyaweb.nl)

> I’m trying to set a default index configuration in config/elastisearch.yml  
> but for some reason it doesn’t seem to get picked up. Can somebody spot the  
> error?
> 
> The ES doesn’t seem to show an error when loading. Here is the yml:
> 
> index:
> 
> analysis:
> 
> ```
> analyzer:
> 
> default_index:
> 
> tokenizer: standard
> 
> filter: [standard, lowercase, my_synonym, my_snow]
> 
> default_search:
> 
> tokenizer: standard
> 
> filter: [standard, lowercase, stop]
> 
> filter:
> 
> my_synonym:
> 
> type: synonym
> 
> synonyms_path: 'analysers/synonyms.dat'
> 
> ignore_case: true
> 
> my_snow:
> 
> type: snowball
> 
> language: English
> 
> ```

---

<div class="post-metadata">

**Author:** ![Yannick\_Smits\_2](https://avatars.discourse-cdn.com/v4/letter/y/a4c791/32.png) [@Yannick\_Smits\_2](https://discuss.elastic.co/u/Yannick_Smits_2)\
**Post date:** [May 28, 2011, 12:34pm UTC](https://discuss.elastic.co/t/index-configuration/4491/5 "2011-05-28T12:34:01Z")

</div>

This is what I get back:

{  
"mms":{  
"settings":{  
"index.number\_of\_shards":"5",  
"index.number\_of\_replicas":"1"  
}  
}  
}

Oh and to reply to David: yes I’m aware that settings have to be applied before the index is created. So I removed the index completely using the delete command before setting the new configuration and adding documents.

From: Shay Banon [[mailto:shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)]  
Sent: zaterdag 28 mei 2011 11:20  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: Re: index configuration

After you create the index, can you execute a get settings on it and see if it was applied to not?[http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html).

On Saturday, May 28, 2011 at 1:21 AM, Yannick Smits wrote:

I’m trying to set a default index configuration in config/elastisearch.yml but for some reason it doesn’t seem to get picked up. Can somebody spot the error?

The ES doesn’t seem to show an error when loading. Here is the yml:

index:

analysis:

```
analyzer:

    default_index:

        tokenizer: standard

        filter: [standard, lowercase, my_synonym, my_snow]

    default_search:

        tokenizer: standard

        filter: [standard, lowercase, stop]

filter:

    my_synonym:

        type: synonym

        synonyms_path: 'analysers/synonyms.dat'

        ignore_case: true

    my_snow:

        type: snowball

        language: English
```

---

<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 28, 2011, 1:49pm UTC](https://discuss.elastic.co/t/index-configuration/4491/6 "2011-05-28T13:49:18Z")

</div>

ok. how do you know that its not getting picked up? Can you gist a repro of what you are seeing?

On Saturday, May 28, 2011 at 3:34 PM, Yannick Smits wrote:

> This is what I get back:
> 
> {  
> "mms":{  
> "settings":{  
> "index.number\_of\_shards":"5",  
> "index.number\_of\_replicas":"1"  
> }  
> }  
> }
> 
> Oh and to reply to David: yes I’m aware that settings have to be applied before the index is created. So I removed the index completely using the delete command before setting the new configuration and adding documents.
> 
> From: Shay Banon [[mailto:shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)]  
> Sent: zaterdag 28 mei 2011 11:20  
> To: [users@elasticsearch.com](mailto:users@elasticsearch.com) ([mailto:users@elasticsearch.com](mailto:users@elasticsearch.com))  
> Subject: Re: index configuration
> 
> After you create the index, can you execute a get settings on it and see if it was applied to not?[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html).  
> On Saturday, May 28, 2011 at 1:21 AM, Yannick Smits wrote:
> 
> > I’m trying to set a default index configuration in config/elastisearch.yml but for some reason it doesn’t seem to get picked up. Can somebody spot the error?  
> > The ES doesn’t seem to show an error when loading. Here is the yml:
> > 
> > index:  
> > analysis:  
> > analyzer:  
> > default\_index:  
> > tokenizer: standard  
> > filter: [standard, lowercase, my\_synonym, my\_snow]  
> > default\_search:  
> > tokenizer: standard  
> > filter: [standard, lowercase, stop]  
> > filter:  
> > my\_synonym:  
> > type: synonym  
> > synonyms\_path: 'analysers/synonyms.dat'  
> > ignore\_case: true  
> > my\_snow:  
> > type: snowball  
> > language: English

---

<div class="post-metadata">

**Author:** ![Yannick\_Smits\_2](https://avatars.discourse-cdn.com/v4/letter/y/a4c791/32.png) [@Yannick\_Smits\_2](https://discuss.elastic.co/u/Yannick_Smits_2)\
**Post date:** [May 28, 2011, 2:12pm UTC](https://discuss.elastic.co/t/index-configuration/4491/7 "2011-05-28T14:12:47Z")

</div>

I tried to search for some of the synonyms in the file which should have matched up with words in my documents, but no results. Also I tested simple search for stemming which didn’t give results either.

Is there a way to get the analysers back from ES to check if they are correctly applied using a command?

Can you explain me what gisting means?

Thanks,  
Yannick

From: Shay Banon [[mailto:shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)]  
Sent: zaterdag 28 mei 2011 15:49  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: Re: index configuration

ok. how do you know that its not getting picked up? Can you gist a repro of what you are seeing?

On Saturday, May 28, 2011 at 3:34 PM, Yannick Smits wrote:

This is what I get back:

{  
"mms":{  
"settings":{  
"index.number\_of\_shards":"5",  
"index.number\_of\_replicas":"1"  
}  
}  
}

Oh and to reply to David: yes I’m aware that settings have to be applied before the index is created. So I removed the index completely using the delete command before setting the new configuration and adding documents.

From: Shay Banon [[mailto:shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)]  
Sent: zaterdag 28 mei 2011 11:20  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: Re: index configuration

After you create the index, can you execute a get settings on it and see if it was applied to not?[http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html).

On Saturday, May 28, 2011 at 1:21 AM, Yannick Smits wrote:

I’m trying to set a default index configuration in config/elastisearch.yml but for some reason it doesn’t seem to get picked up. Can somebody spot the error?

The ES doesn’t seem to show an error when loading. Here is the yml:

index:

analysis:

```
analyzer:

    default_index:

        tokenizer: standard

        filter: [standard, lowercase, my_synonym, my_snow]

    default_search:

        tokenizer: standard

        filter: [standard, lowercase, stop]

filter:

    my_synonym:

        type: synonym

        synonyms_path: 'analysers/synonyms.dat'

        ignore_case: true

    my_snow:

        type: snowball

        language: English
```

---

<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 29, 2011, 3:03pm UTC](https://discuss.elastic.co/t/index-configuration/4491/8 "2011-05-29T15:03:20Z")

</div>

Gist: [http://gist.github.com](http://gist.github.com) Use the analyze API to test for the analysis.

On Saturday, May 28, 2011 at 5:12 PM, Yannick Smits wrote:

> I tried to search for some of the synonyms in the file which should have matched up with words in my documents, but no results. Also I tested simple search for stemming which didn’t give results either.
> 
> Is there a way to get the analysers back from ES to check if they are correctly applied using a command?
> 
> Can you explain me what gisting means?
> 
> Thanks,  
> Yannick
> 
> From: Shay Banon [[mailto:shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)]  
> Sent: zaterdag 28 mei 2011 15:49  
> To: [users@elasticsearch.com](mailto:users@elasticsearch.com) ([mailto:users@elasticsearch.com](mailto:users@elasticsearch.com))  
> Subject: Re: index configuration
> 
> ok. how do you know that its not getting picked up? Can you gist a repro of what you are seeing?  
> On Saturday, May 28, 2011 at 3:34 PM, Yannick Smits wrote:
> 
> > This is what I get back:
> > 
> > {  
> > "mms":{  
> > "settings":{  
> > "index.number\_of\_shards":"5",  
> > "index.number\_of\_replicas":"1"  
> > }  
> > }  
> > }
> > 
> > Oh and to reply to David: yes I’m aware that settings have to be applied before the index is created. So I removed the index completely using the delete command before setting the new configuration and adding documents.
> > 
> > From: Shay Banon [[mailto:shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)]  
> > Sent: zaterdag 28 mei 2011 11:20  
> > To: [users@elasticsearch.com](mailto:users@elasticsearch.com) ([mailto:users@elasticsearch.com](mailto:users@elasticsearch.com))  
> > Subject: Re: index configuration
> > 
> > After you create the index, can you execute a get settings on it and see if it was applied to not?[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html).  
> > On Saturday, May 28, 2011 at 1:21 AM, Yannick Smits wrote:
> > 
> > > I’m trying to set a default index configuration in config/elastisearch.yml but for some reason it doesn’t seem to get picked up. Can somebody spot the error?  
> > > The ES doesn’t seem to show an error when loading. Here is the yml:
> > > 
> > > index:  
> > > analysis:  
> > > analyzer:  
> > > default\_index:  
> > > tokenizer: standard  
> > > filter: [standard, lowercase, my\_synonym, my\_snow]  
> > > default\_search:  
> > > tokenizer: standard  
> > > filter: [standard, lowercase, stop]  
> > > filter:  
> > > my\_synonym:  
> > > type: synonym  
> > > synonyms\_path: 'analysers/synonyms.dat'  
> > > ignore\_case: true  
> > > my\_snow:  
> > > type: snowball  
> > > language: English

---

<div class="post-metadata">

**Author:** ![Yannick\_Smits\_2](https://avatars.discourse-cdn.com/v4/letter/y/a4c791/32.png) [@Yannick\_Smits\_2](https://discuss.elastic.co/u/Yannick_Smits_2)\
**Post date:** [May 31, 2011, 10:31am UTC](https://discuss.elastic.co/t/index-configuration/4491/9 "2011-05-31T10:31:18Z")

</div>

Ok, I got the analyzer settings to shop up in the index \_settings request by using a JSON put. Cannot seem to set those using the YAML approach as explained below.

But even while the JSON method of setting it does seem to get through my tests show they are not working / not configured correctly.

I’ve gisted that: [https://gist.github.com/1000276](https://gist.github.com/1000276) [https://gist.github.com/1000276](https://gist.github.com/1000276)

The last 2 curl requests should give 1 result but give 0 instead.

Thanks,

Yannick

From: Shay Banon [[mailto:shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)]  
Sent: zondag 29 mei 2011 17:03  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: Re: index configuration

Gist: [http://gist.github.com](http://gist.github.com) Use the analyze API to test for the analysis.

On Saturday, May 28, 2011 at 5:12 PM, Yannick Smits wrote:

I tried to search for some of the synonyms in the file which should have matched up with words in my documents, but no results. Also I tested simple search for stemming which didn’t give results either.

Is there a way to get the analysers back from ES to check if they are correctly applied using a command?

Can you explain me what gisting means?

Thanks,  
Yannick

From: Shay Banon [[mailto:shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)]  
Sent: zaterdag 28 mei 2011 15:49  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: Re: index configuration

ok. how do you know that its not getting picked up? Can you gist a repro of what you are seeing?

On Saturday, May 28, 2011 at 3:34 PM, Yannick Smits wrote:

This is what I get back:

{  
"mms":{  
"settings":{  
"index.number\_of\_shards":"5",  
"index.number\_of\_replicas":"1"  
}  
}  
}

Oh and to reply to David: yes I’m aware that settings have to be applied before the index is created. So I removed the index completely using the delete command before setting the new configuration and adding documents.

From: Shay Banon [[mailto:shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)]  
Sent: zaterdag 28 mei 2011 11:20  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: Re: index configuration

After you create the index, can you execute a get settings on it and see if it was applied to not?[http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html).

On Saturday, May 28, 2011 at 1:21 AM, Yannick Smits wrote:

I’m trying to set a default index configuration in config/elastisearch.yml but for some reason it doesn’t seem to get picked up. Can somebody spot the error?

The ES doesn’t seem to show an error when loading. Here is the yml:

index:

analysis:

```
analyzer:

    default_index:

        tokenizer: standard

        filter: [standard, lowercase, my_synonym, my_snow]

    default_search:

        tokenizer: standard

        filter: [standard, lowercase, stop]

filter:

    my_synonym:

        type: synonym

        synonyms_path: 'analysers/synonyms.dat'

        ignore_case: true

    my_snow:

        type: snowball

        language: English
```

---

<div class="post-metadata">

**Author:** ![Yannick\_Smits\_2](https://avatars.discourse-cdn.com/v4/letter/y/a4c791/32.png) [@Yannick\_Smits\_2](https://discuss.elastic.co/u/Yannick_Smits_2)\
**Post date:** [June 3, 2011, 3:18pm UTC](https://discuss.elastic.co/t/index-configuration/4491/10 "2011-06-03T15:18:19Z")

</div>

Could anybody try my gist? This issue is still unresolved.

> <https://gist.github.com/goyaweb/1006503>

From: Yannick Smits [[mailto:mailinglists@goyaweb.nl](mailto:mailinglists@goyaweb.nl)]  
Sent: dinsdag 31 mei 2011 12:31  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: RE: index configuration

Ok, I got the analyzer settings to shop up in the index \_settings request by using a JSON put. Cannot seem to set those using the YAML approach as explained below.

But even while the JSON method of setting it does seem to get through my tests show they are not working / not configured correctly.

I’ve gisted that: [https://gist.github.com/1006503](https://gist.github.com/1006503) [https://gist.github.com/1006503](https://gist.github.com/1006503)

The last 2 curl requests should give 1 result but give 0 instead.

Thanks,

Yannick

From: Shay Banon [[mailto:shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)]  
Sent: zondag 29 mei 2011 17:03  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: Re: index configuration

Gist: [http://gist.github.com](http://gist.github.com) Use the analyze API to test for the analysis.

On Saturday, May 28, 2011 at 5:12 PM, Yannick Smits wrote:

I tried to search for some of the synonyms in the file which should have matched up with words in my documents, but no results. Also I tested simple search for stemming which didn’t give results either.

Is there a way to get the analysers back from ES to check if they are correctly applied using a command?

Can you explain me what gisting means?

Thanks,  
Yannick

From: Shay Banon [[mailto:shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)]  
Sent: zaterdag 28 mei 2011 15:49  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: Re: index configuration

ok. how do you know that its not getting picked up? Can you gist a repro of what you are seeing?

On Saturday, May 28, 2011 at 3:34 PM, Yannick Smits wrote:

This is what I get back:

{  
"mms":{  
"settings":{  
"index.number\_of\_shards":"5",  
"index.number\_of\_replicas":"1"  
}  
}  
}

Oh and to reply to David: yes I’m aware that settings have to be applied before the index is created. So I removed the index completely using the delete command before setting the new configuration and adding documents.

From: Shay Banon [[mailto:shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)]  
Sent: zaterdag 28 mei 2011 11:20  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: Re: index configuration

After you create the index, can you execute a get settings on it and see if it was applied to not?[http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html).

On Saturday, May 28, 2011 at 1:21 AM, Yannick Smits wrote:

I’m trying to set a default index configuration in config/elastisearch.yml but for some reason it doesn’t seem to get picked up. Can somebody spot the error?

The ES doesn’t seem to show an error when loading. Here is the yml:

index:

analysis:

```
analyzer:

    default_index:

        tokenizer: standard

        filter: [standard, lowercase, my_synonym, my_snow]

    default_search:

        tokenizer: standard

        filter: [standard, lowercase, stop]

filter:

    my_synonym:

        type: synonym

        synonyms_path: 'analysers/synonyms.dat'

        ignore_case: true

    my_snow:

        type: snowball

        language: English
```

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [June 3, 2011, 3:32pm UTC](https://discuss.elastic.co/t/index-configuration/4491/11 "2011-06-03T15:32:38Z")

</div>

Hi Yannick

On Fri, 2011-06-03 at 17:18 +0200, Yannick Smits wrote:

> Could anybody try my gist? This issue is still unresolved.
> 
> [Cannot apply analyzers · GitHub](https://gist.github.com/1006503)

You're using the snowball filter on text that you are indexing but then:

1. you're using a term query, which doesn't get analysed, instead of  
a text|field|query\_string query

2. even if you were using a text|field|query\_string query, it probably  
would fail as well, because your default search analyzer doesn't  
include the snowball filter.

You almost always want to use the same analyzer for indexing and for  
searching

clint

---

<div class="post-metadata">

**Author:** ![Yannick\_Smits\_2](https://avatars.discourse-cdn.com/v4/letter/y/a4c791/32.png) [@Yannick\_Smits\_2](https://discuss.elastic.co/u/Yannick_Smits_2)\
**Post date:** [June 4, 2011, 2:26pm UTC](https://discuss.elastic.co/t/index-configuration/4491/12 "2011-06-04T14:26:19Z")

</div>

Hi Clint,

Thanks for pointing this out to me. Now using a text query and making the index and search analyzers equal everything works as expected. The only thing I can't seem to get to work is setting the default analyzers inside the elasticsearch.yml. But using the json put method it works well enough for me now.

Thanks!

-----Original Message-----  
From: Clinton Gormley [[mailto:clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)]  
Sent: vrijdag 3 juni 2011 17:33  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: RE: index configuration

Hi Yannick

On Fri, 2011-06-03 at 17:18 +0200, Yannick Smits wrote:

> Could anybody try my gist? This issue is still unresolved.
> 
> [Cannot apply analyzers · GitHub](https://gist.github.com/1006503)

You're using the snowball filter on text that you are indexing but then:

1. you're using a term query, which doesn't get analysed, instead of  
a text|field|query\_string query

2. even if you were using a text|field|query\_string query, it probably  
would fail as well, because your default search analyzer doesn't  
include the snowball filter.

You almost always want to use the same analyzer for indexing and for searching

clint

---

<div class="post-metadata">

**Author:** ![Yannick\_Smits\_2](https://avatars.discourse-cdn.com/v4/letter/y/a4c791/32.png) [@Yannick\_Smits\_2](https://discuss.elastic.co/u/Yannick_Smits_2)\
**Post date:** [June 6, 2011, 2:23pm UTC](https://discuss.elastic.co/t/index-configuration/4491/13 "2011-06-06T14:23:20Z")

</div>

> You almost always want to use the same analyzer for indexing and for searching

Could you elaborate on why that is? I would imagine if the synonyms are already applied to the index that it doesn't make sense to apply the synonyms on the search query, because they are already matched in the index.

-----Original Message-----  
From: Yannick Smits [[mailto:mailinglists@goyaweb.nl](mailto:mailinglists@goyaweb.nl)]  
Sent: zaterdag 4 juni 2011 16:26  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: RE: index configuration

Hi Clint,

Thanks for pointing this out to me. Now using a text query and making the index and search analyzers equal everything works as expected. The only thing I can't seem to get to work is setting the default analyzers inside the elasticsearch.yml. But using the json put method it works well enough for me now.

Thanks!

-----Original Message-----  
From: Clinton Gormley [[mailto:clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)]  
Sent: vrijdag 3 juni 2011 17:33  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: RE: index configuration

Hi Yannick

On Fri, 2011-06-03 at 17:18 +0200, Yannick Smits wrote:

> Could anybody try my gist? This issue is still unresolved.
> 
> [Cannot apply analyzers · GitHub](https://gist.github.com/1006503)

You're using the snowball filter on text that you are indexing but then:

1. you're using a term query, which doesn't get analysed, instead of  
a text|field|query\_string query

2. even if you were using a text|field|query\_string query, it probably  
would fail as well, because your default search analyzer doesn't  
include the snowball filter.

You almost always want to use the same analyzer for indexing and for searching

clint

---

<div class="post-metadata">

**Author:** ![James\_Cook](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@James\_Cook](https://discuss.elastic.co/u/James_Cook)\
**Post date:** [June 6, 2011, 2:48pm UTC](https://discuss.elastic.co/t/index-configuration/4491/14 "2011-06-06T14:48:26Z")

</div>

How do you specify which analyzer to use for searching?

On Mon, Jun 6, 2011 at 10:23 AM, Yannick Smits [mailinglists@goyaweb.nl](mailto:mailinglists@goyaweb.nl)wrote:

> > You almost always want to use the same analyzer for indexing and for  
> > searching
> 
> Could you elaborate on why that is? I would imagine if the synonyms are  
> already applied to the index that it doesn't make sense to apply the  
> synonyms on the search query, because they are already matched in the index.
> 
> -----Original Message-----  
> From: Yannick Smits [[mailto:mailinglists@goyaweb.nl](mailto:mailinglists@goyaweb.nl)]  
> Sent: zaterdag 4 juni 2011 16:26  
> To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
> Subject: RE: index configuration
> 
> Hi Clint,
> 
> Thanks for pointing this out to me. Now using a text query and making the  
> index and search analyzers equal everything works as expected. The only  
> thing I can't seem to get to work is setting the default analyzers inside  
> the elasticsearch.yml. But using the json put method it works well enough  
> for me now.
> 
> Thanks!
> 
> -----Original Message-----  
> From: Clinton Gormley [[mailto:clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)]  
> Sent: vrijdag 3 juni 2011 17:33  
> To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
> Subject: RE: index configuration
> 
> Hi Yannick
> 
> On Fri, 2011-06-03 at 17:18 +0200, Yannick Smits wrote:
> 
> > Could anybody try my gist? This issue is still unresolved.
> > 
> > [Cannot apply analyzers · GitHub](https://gist.github.com/1006503)
> 
> You're using the snowball filter on text that you are indexing but then:
> 
> 1. you're using a term query, which doesn't get analysed, instead of  
> a text|field|query\_string query
> 
> 2. even if you were using a text|field|query\_string query, it probably  
> would fail as well, because your default search analyzer doesn't  
> include the snowball filter.
> 
> You almost always want to use the same analyzer for indexing and for  
> searching
> 
> clint

---

<div class="post-metadata">

**Author:** ![Yannick\_Smits\_2](https://avatars.discourse-cdn.com/v4/letter/y/a4c791/32.png) [@Yannick\_Smits\_2](https://discuss.elastic.co/u/Yannick_Smits_2)\
**Post date:** [June 6, 2011, 2:59pm UTC](https://discuss.elastic.co/t/index-configuration/4491/15 "2011-06-06T14:59:32Z")

</div>

> <https://gist.github.com/goyaweb/1006503>

From: James Cook [[mailto:jcook@tracermedia.com](mailto:jcook@tracermedia.com)]  
Sent: maandag 6 juni 2011 16:48  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: Re: index configuration

How do you specify which analyzer to use for searching?

On Mon, Jun 6, 2011 at 10:23 AM, Yannick Smits [mailinglists@goyaweb.nl](mailto:mailinglists@goyaweb.nl)  
wrote:

> You almost always want to use the same analyzer for indexing and for  
> searching

Could you elaborate on why that is? I would imagine if the synonyms are  
already applied to the index that it doesn't make sense to apply the  
synonyms on the search query, because they are already matched in the index.

-----Original Message-----  
From: Yannick Smits [[mailto:mailinglists@goyaweb.nl](mailto:mailinglists@goyaweb.nl)]

Sent: zaterdag 4 juni 2011 16:26  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: RE: index configuration

Hi Clint,

Thanks for pointing this out to me. Now using a text query and making the  
index and search analyzers equal everything works as expected. The only  
thing I can't seem to get to work is setting the default analyzers inside  
the elasticsearch.yml. But using the json put method it works well enough  
for me now.

Thanks!

-----Original Message-----  
From: Clinton Gormley [[mailto:clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)]  
Sent: vrijdag 3 juni 2011 17:33  
To: [users@elasticsearch.com](mailto:users@elasticsearch.com)  
Subject: RE: index configuration

Hi Yannick

On Fri, 2011-06-03 at 17:18 +0200, Yannick Smits wrote:

> Could anybody try my gist? This issue is still unresolved.
> 
> [Cannot apply analyzers · GitHub](https://gist.github.com/1006503)

You're using the snowball filter on text that you are indexing but then:

1. you're using a term query, which doesn't get analysed, instead of  
a text|field|query\_string query

2. even if you were using a text|field|query\_string query, it probably  
would fail as well, because your default search analyzer doesn't  
include the snowball filter.

You almost always want to use the same analyzer for indexing and for  
searching

clint

---

<div class="post-metadata">

**Author:** ![Greg\_Brown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greg_brown/32/1373_2.png) [@Greg\_Brown](https://discuss.elastic.co/u/Greg_Brown)\
**Post date:** [June 6, 2011, 9:02pm UTC](https://discuss.elastic.co/t/index-configuration/4491/16 "2011-06-06T21:02:24Z")

</div>

> Could you elaborate on why that is? I would imagine if the synonyms are already applied to the index that it doesn't make sense to apply the synonyms on the search query, because they are already matched in the index.

You're right that for synonyms this probably doesn't matter; however,  
for the snowball stemmer you are using you definitely should apply it  
to both the query and the index since the the stemmer will cause only  
the stemmed version of words to be indexed, while a user will often  
search with words that are not stemmed. So for instance, a search for  
the word "indexing" will not match anything if all documents in the  
index have had the word "indexing" stemmed to "index".

Generally good practice to just use the same analyzer for both the  
query and indexing to avoid these types of problems.

On Jun 6, 8:23 am, Yannick Smits [mailingli...@goyaweb.nl](mailto:mailingli...@goyaweb.nl) wrote:

> > You almost always want to use the same analyzer for indexing and for searching
> 
> Could you elaborate on why that is? I would imagine if the synonyms are already applied to the index that it doesn't make sense to apply the synonyms on the search query, because they are already matched in the index.
> 
> -----Original Message-----  
> From: Yannick Smits [[mailto:mailingli...@goyaweb.nl](mailto:mailingli...@goyaweb.nl)]  
> Sent: zaterdag 4 juni 2011 16:26  
> To: [us...@elasticsearch.com](mailto:us...@elasticsearch.com)  
> Subject: RE: index configuration
> 
> Hi Clint,
> 
> Thanks for pointing this out to me. Now using a text query and making the index and search analyzers equal everything works as expected. The only thing I can't seem to get to work is setting the default analyzers inside the elasticsearch.yml. But using the json put method it works well enough for me now.
> 
> Thanks!
> 
> -----Original Message-----  
> From: Clinton Gormley [[mailto:clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk)]  
> Sent: vrijdag 3 juni 2011 17:33  
> To: [us...@elasticsearch.com](mailto:us...@elasticsearch.com)  
> Subject: RE: index configuration
> 
> Hi Yannick
> 
> On Fri, 2011-06-03 at 17:18 +0200, Yannick Smits wrote:
> 
> > Could anybody try my gist? This issue is still unresolved.
> 
> > [Cannot apply analyzers · GitHub](https://gist.github.com/1006503)
> 
> You're using the snowball filter on text that you are indexing but then:
> 
> 1. you're using a term query, which doesn't get analysed, instead of  
> a text|field|query\_string query
> 
> 2. even if you were using a text|field|query\_string query, it probably  
> would fail as well, because your default search analyzer doesn't  
> include the snowball filter.
> 
> You almost always want to use the same analyzer for indexing and for searching
> 
> clint

---

<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, 4:04am UTC](https://discuss.elastic.co/t/index-configuration/4491/17 "2017-07-06T04:04:28Z")

</div>


