# ElasticSearch with stemming/snwoball

**URL:** <https://discuss.elastic.co/t/elasticsearch-with-stemming-snwoball/4005>\
**Category:** Elasticsearch\
**Created:** [March 1, 2011, 7:21pm UTC](https://discuss.elastic.co/t/elasticsearch-with-stemming-snwoball/4005 "2011-03-01T19:21:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Torsten](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@Torsten](https://discuss.elastic.co/u/Torsten)\
**Post date:** [March 1, 2011, 7:21pm UTC](https://discuss.elastic.co/t/elasticsearch-with-stemming-snwoball/4005/1 "2011-03-01T19:21:38Z")

</div>

Hello,

I am using ElasticSearch (0.15.0) as a search engine with full-text  
search and word highlighting. It works but I'm not able to configure  
an analyser with word stemming.  
I know that my problem is very similar to  
[http://stackoverflow.com/questions/4981001/why-elasticsearch-is-not-finding-my-term](http://stackoverflow.com/questions/4981001/why-elasticsearch-is-not-finding-my-term).  
I tried the suggested solution but  
it still doesn't work.

My cluster metadata looks like this:  
metadata: {  
templates: { }  
indices: {  
test\_index: {  
state: open  
settings: {  
index.analysis.filter.snowball.language: English  
index.analysis.analyzer.search\_analyzer.filter.0:  
lowercase  
index.analysis.analyzer.search\_analyzer.filter.1:  
snowball  
index.analysis.analyzer.index\_analyzer.filter.0:  
lowercase  
index.analysis.filter.snowball.type: snowball  
index.analysis.analyzer.search\_analyzer.tokenizer:  
nGram  
index.analysis.analyzer.index\_analyzer.tokenizer:  
nGram  
index.analysis.analyzer.index\_analyzer.filter.1:  
snowball  
index.number\_of\_shards: 5  
index.number\_of\_replicas: 1  
}  
mappings: {  
test\_item: {  
properties: {  
title: {  
store: yes  
analyzer: standard  
term\_vector: with\_positions\_offsets  
type: string  
}  
description: {  
store: yes  
analyzer: standard  
term\_vector: with\_positions\_offsets  
type: string  
}  
link: {  
type: string  
}  
}  
}  
}  
aliases: []  
}  
}  
}

And my query:  
curl -XGET '[http://localhost:9200/\_search?pretty=true](http://localhost:9200/_search?pretty=true)' -d '  
{  
"highlight": {  
"tags\_schema": "styled",  
"fields": {  
"title": {  
"number\_of\_fragments": 0  
},  
"description": {  
"number\_of\_fragments": 0  
}  
}  
},  
"query": {  
"query\_string": {  
"fields" : ["title", "description"],  
"query" : "apple" /\* finds entries with "apple", a search  
with "apples" finds nothing \*/  
}  
}  
}'

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

Any hints? Thanks in advance!

---

<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:** [March 2, 2011, 12:41am UTC](https://discuss.elastic.co/t/elasticsearch-with-stemming-snwoball/4005/2 "2011-03-02T00:41:24Z")

</div>

Cam you gist a curl recreation with the curl that created the index with the relevant mapping and analyzer config?  
On Tuesday, March 1, 2011 at 9:21 PM, Torsten wrote:

> Hello,
> 
> I am using Elasticsearch (0.15.0) as a search engine with full-text  
> search and word highlighting. It works but I'm not able to configure  
> an analyser with word stemming.  
> I know that my problem is very similar to  
> [Why ElasticSearch is not finding my term - Stack Overflow](http://stackoverflow.com/questions/4981001/why-elasticsearch-is-not-finding-my-term).  
> I tried the suggested solution but  
> it still doesn't work.
> 
> My cluster metadata looks like this:  
> metadata: {  
> templates: { }  
> indices: {  
> test\_index: {  
> state: open  
> settings: {  
> index.analysis.filter.snowball.language: English  
> index.analysis.analyzer.search\_analyzer.filter.0:  
> lowercase  
> index.analysis.analyzer.search\_analyzer.filter.1:  
> snowball  
> index.analysis.analyzer.index\_analyzer.filter.0:  
> lowercase  
> index.analysis.filter.snowball.type: snowball  
> index.analysis.analyzer.search\_analyzer.tokenizer:  
> nGram  
> index.analysis.analyzer.index\_analyzer.tokenizer:  
> nGram  
> index.analysis.analyzer.index\_analyzer.filter.1:  
> snowball  
> index.number\_of\_shards: 5  
> index.number\_of\_replicas: 1  
> }  
> mappings: {  
> test\_item: {  
> properties: {  
> title: {  
> store: yes  
> analyzer: standard  
> term\_vector: with\_positions\_offsets  
> type: string  
> }  
> description: {  
> store: yes  
> analyzer: standard  
> term\_vector: with\_positions\_offsets  
> type: string  
> }  
> link: {  
> type: string  
> }  
> }  
> }  
> }  
> aliases:   
> }  
> }  
> }
> 
> And my query:  
> curl -XGET '[http://localhost:9200/\_search?pretty=true](http://localhost:9200/_search?pretty=true)' -d '  
> {  
> "highlight": {  
> "tags\_schema": "styled",  
> "fields": {  
> "title": {  
> "number\_of\_fragments": 0  
> },  
> "description": {  
> "number\_of\_fragments": 0  
> }  
> }  
> },  
> "query": {  
> "query\_string": {  
> "fields" : ["title", "description"],  
> "query" : "apple" /\* finds entries with "apple", a search  
> with "apples" finds nothing \*/  
> }  
> }  
> }'
> 
> [ElasticSearch with stemming · GitHub](https://gist.github.com/849684)
> 
> Any hints? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Torsten](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@Torsten](https://discuss.elastic.co/u/Torsten)\
**Post date:** [March 2, 2011, 7:56pm UTC](https://discuss.elastic.co/t/elasticsearch-with-stemming-snwoball/4005/3 "2011-03-02T19:56:35Z")

</div>

Sure: [gist:851600 · GitHub](https://gist.github.com/851600)

On Mar 2, 1:41 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Cam you gist a curl recreation with the curl that created the index with the relevant mapping and analyzer config?
> 
> On Tuesday, March 1, 2011 at 9:21 PM, Torsten wrote:
> 
> > Hello,
> 
> > I am using Elasticsearch (0.15.0) as a search engine with full-text  
> > search and word highlighting. It works but I'm not able to configure  
> > an analyser with word stemming.  
> > I know that my problem is very similar to  
> > [Why ElasticSearch is not finding my term - Stack Overflow](http://stackoverflow.com/questions/4981001/why-elasticsearch-is-not-f)....  
> > I tried the suggested solution but  
> > it still doesn't work.
> 
> > My cluster metadata looks like this:  
> > metadata: {  
> > templates: { }  
> > indices: {  
> > test\_index: {  
> > state: open  
> > settings: {  
> > index.analysis.filter.snowball.language: English  
> > index.analysis.analyzer.search\_analyzer.filter.0:  
> > lowercase  
> > index.analysis.analyzer.search\_analyzer.filter.1:  
> > snowball  
> > index.analysis.analyzer.index\_analyzer.filter.0:  
> > lowercase  
> > index.analysis.filter.snowball.type: snowball  
> > index.analysis.analyzer.search\_analyzer.tokenizer:  
> > nGram  
> > index.analysis.analyzer.index\_analyzer.tokenizer:  
> > nGram  
> > index.analysis.analyzer.index\_analyzer.filter.1:  
> > snowball  
> > index.number\_of\_shards: 5  
> > index.number\_of\_replicas: 1  
> > }  
> > mappings: {  
> > test\_item: {  
> > properties: {  
> > title: {  
> > store: yes  
> > analyzer: standard  
> > term\_vector: with\_positions\_offsets  
> > type: string  
> > }  
> > description: {  
> > store: yes  
> > analyzer: standard  
> > term\_vector: with\_positions\_offsets  
> > type: string  
> > }  
> > link: {  
> > type: string  
> > }  
> > }  
> > }  
> > }  
> > aliases:   
> > }  
> > }  
> > }
> 
> > And my query:  
> > curl -XGET '[http://localhost:9200/\_search?pretty=true'-d](http://localhost:9200/_search?pretty=true'-d) '  
> > {  
> > "highlight": {  
> > "tags\_schema": "styled",  
> > "fields": {  
> > "title": {  
> > "number\_of\_fragments": 0  
> > },  
> > "description": {  
> > "number\_of\_fragments": 0  
> > }  
> > }  
> > },  
> > "query": {  
> > "query\_string": {  
> > "fields" : ["title", "description"],  
> > "query" : "apple" /\* finds entries with "apple", a search  
> > with "apples" finds nothing \*/  
> > }  
> > }  
> > }'
> 
> > [ElasticSearch with stemming · GitHub](https://gist.github.com/849684)
> 
> > Any hints? Thanks in advance!

---

<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:** [March 2, 2011, 11:01pm UTC](https://discuss.elastic.co/t/elasticsearch-with-stemming-snwoball/4005/4 "2011-03-02T23:01:21Z")

</div>

Heya,

You don't specify the analyzer setting in the mapping, and the `index_analyzer` and `search_analyzer` do not control the default analyzers to be used in mappings case when none is specified. For that, you can specify the "default" name (for both index and search), or "default\_index" and "default\_search".

Also, make sure, using the analyze API, that you are getting what you are after, since combining ngram with stemming might make little sense (especially with the default ngram settings).

You can, if oyu want, have a multi\_field mapping, and have one mapping indexed using just ngram, and one with just stemming.

-shay.banon  
On Wednesday, March 2, 2011 at 9:56 PM, Torsten wrote:

> Sure: [gist:851600 · GitHub](https://gist.github.com/851600)
> 
> On Mar 2, 1:41 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Cam you gist a curl recreation with the curl that created the index with the relevant mapping and analyzer config?
> > 
> > On Tuesday, March 1, 2011 at 9:21 PM, Torsten wrote:
> > 
> > > Hello,
> > 
> > > I am using Elasticsearch (0.15.0) as a search engine with full-text  
> > > search and word highlighting. It works but I'm not able to configure  
> > > an analyser with word stemming.  
> > > I know that my problem is very similar to  
> > > [Why ElasticSearch is not finding my term - Stack Overflow](http://stackoverflow.com/questions/4981001/why-elasticsearch-is-not-f)....  
> > > I tried the suggested solution but  
> > > it still doesn't work.
> > 
> > > My cluster metadata looks like this:  
> > > metadata: {  
> > > templates: { }  
> > > indices: {  
> > > test\_index: {  
> > > state: open  
> > > settings: {  
> > > index.analysis.filter.snowball.language: English  
> > > index.analysis.analyzer.search\_analyzer.filter.0:  
> > > lowercase  
> > > index.analysis.analyzer.search\_analyzer.filter.1:  
> > > snowball  
> > > index.analysis.analyzer.index\_analyzer.filter.0:  
> > > lowercase  
> > > index.analysis.filter.snowball.type: snowball  
> > > index.analysis.analyzer.search\_analyzer.tokenizer:  
> > > nGram  
> > > index.analysis.analyzer.index\_analyzer.tokenizer:  
> > > nGram  
> > > index.analysis.analyzer.index\_analyzer.filter.1:  
> > > snowball  
> > > index.number\_of\_shards: 5  
> > > index.number\_of\_replicas: 1  
> > > }  
> > > mappings: {  
> > > test\_item: {  
> > > properties: {  
> > > title: {  
> > > store: yes  
> > > analyzer: standard  
> > > term\_vector: with\_positions\_offsets  
> > > type: string  
> > > }  
> > > description: {  
> > > store: yes  
> > > analyzer: standard  
> > > term\_vector: with\_positions\_offsets  
> > > type: string  
> > > }  
> > > link: {  
> > > type: string  
> > > }  
> > > }  
> > > }  
> > > }  
> > > aliases:   
> > > }  
> > > }  
> > > }
> > 
> > > And my query:  
> > > curl -XGET '[http://localhost:9200/\_search?pretty=true'-d](http://localhost:9200/_search?pretty=true'-d) '  
> > > {  
> > > "highlight": {  
> > > "tags\_schema": "styled",  
> > > "fields": {  
> > > "title": {  
> > > "number\_of\_fragments": 0  
> > > },  
> > > "description": {  
> > > "number\_of\_fragments": 0  
> > > }  
> > > }  
> > > },  
> > > "query": {  
> > > "query\_string": {  
> > > "fields" : ["title", "description"],  
> > > "query" : "apple" /\* finds entries with "apple", a search  
> > > with "apples" finds nothing \*/  
> > > }  
> > > }  
> > > }'
> > 
> > > [ElasticSearch with stemming · GitHub](https://gist.github.com/849684)
> > 
> > > Any hints? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Torsten](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@Torsten](https://discuss.elastic.co/u/Torsten)\
**Post date:** [March 3, 2011, 12:49am UTC](https://discuss.elastic.co/t/elasticsearch-with-stemming-snwoball/4005/5 "2011-03-03T00:49:24Z")

</div>

Now it works, thanks a lot for your help!

On Mar 3, 12:01 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Heya,
> 
> You don't specify the analyzer setting in the mapping, and the `index_analyzer` and `search_analyzer` do not control the default analyzers to be used in mappings case when none is specified. For that, you can specify the "default" name (for both index and search), or "default\_index" and "default\_search".
> 
> Also, make sure, using the analyze API, that you are getting what you are after, since combining ngram with stemming might make little sense (especially with the default ngram settings).
> 
> You can, if oyu want, have a multi\_field mapping, and have one mapping indexed using just ngram, and one with just stemming.
> 
> -shay.banon
> 
> On Wednesday, March 2, 2011 at 9:56 PM, Torsten wrote:
> 
> > Sure:[gist:851600 · GitHub](https://gist.github.com/851600)
> 
> > On Mar 2, 1:41 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > Cam you gist a curl recreation with the curl that created the index with the relevant mapping and analyzer config?
> 
> > > On Tuesday, March 1, 2011 at 9:21 PM, Torsten wrote:
> > > 
> > > > Hello,
> 
> > > > I am using Elasticsearch (0.15.0) as a search engine with full-text  
> > > > search and word highlighting. It works but I'm not able to configure  
> > > > an analyser with word stemming.  
> > > > I know that my problem is very similar to  
> > > > [Why ElasticSearch is not finding my term - Stack Overflow](http://stackoverflow.com/questions/4981001/why-elasticsearch-is-not-f)....  
> > > > I tried the suggested solution but  
> > > > it still doesn't work.
> 
> > > > My cluster metadata looks like this:  
> > > > metadata: {  
> > > > templates: { }  
> > > > indices: {  
> > > > test\_index: {  
> > > > state: open  
> > > > settings: {  
> > > > index.analysis.filter.snowball.language: English  
> > > > index.analysis.analyzer.search\_analyzer.filter.0:  
> > > > lowercase  
> > > > index.analysis.analyzer.search\_analyzer.filter.1:  
> > > > snowball  
> > > > index.analysis.analyzer.index\_analyzer.filter.0:  
> > > > lowercase  
> > > > index.analysis.filter.snowball.type: snowball  
> > > > index.analysis.analyzer.search\_analyzer.tokenizer:  
> > > > nGram  
> > > > index.analysis.analyzer.index\_analyzer.tokenizer:  
> > > > nGram  
> > > > index.analysis.analyzer.index\_analyzer.filter.1:  
> > > > snowball  
> > > > index.number\_of\_shards: 5  
> > > > index.number\_of\_replicas: 1  
> > > > }  
> > > > mappings: {  
> > > > test\_item: {  
> > > > properties: {  
> > > > title: {  
> > > > store: yes  
> > > > analyzer: standard  
> > > > term\_vector: with\_positions\_offsets  
> > > > type: string  
> > > > }  
> > > > description: {  
> > > > store: yes  
> > > > analyzer: standard  
> > > > term\_vector: with\_positions\_offsets  
> > > > type: string  
> > > > }  
> > > > link: {  
> > > > type: string  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > aliases:   
> > > > }  
> > > > }  
> > > > }
> 
> > > > And my query:  
> > > > curl -XGET '[http://localhost:9200/\_search?pretty=true'-d'](http://localhost:9200/_search?pretty=true'-d')  
> > > > {  
> > > > "highlight": {  
> > > > "tags\_schema": "styled",  
> > > > "fields": {  
> > > > "title": {  
> > > > "number\_of\_fragments": 0  
> > > > },  
> > > > "description": {  
> > > > "number\_of\_fragments": 0  
> > > > }  
> > > > }  
> > > > },  
> > > > "query": {  
> > > > "query\_string": {  
> > > > "fields" : ["title", "description"],  
> > > > "query" : "apple" /\* finds entries with "apple", a search  
> > > > with "apples" finds nothing \*/  
> > > > }  
> > > > }  
> > > > }'
> 
> > > > [ElasticSearch with stemming · GitHub](https://gist.github.com/849684)
> 
> > > > Any hints? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Rich\_Kroll](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rich_kroll/32/3229_2.png) [@Rich\_Kroll](https://discuss.elastic.co/u/Rich_Kroll)\
**Post date:** [March 3, 2011, 5:04pm UTC](https://discuss.elastic.co/t/elasticsearch-with-stemming-snwoball/4005/6 "2011-03-03T17:04:11Z")

</div>

Torsten,  
Can you gist your config so that others stumbling on this thread can  
see what the proper mapping looks like? This seems to be a recurring  
issue for people (myself included), so it would be great to have an  
example of how to properly configure this.

Thanks!

Rich

On Mar 2, 7:49 pm, Torsten [admiralc...@gmail.com](mailto:admiralc...@gmail.com) wrote:

> Now it works, thanks a lot for your help!
> 
> On Mar 3, 12:01 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Heya,
> 
> > You don't specify the analyzer setting in the mapping, and the `index_analyzer` and `search_analyzer` do not control the default analyzers to be used in mappings case when none is specified. For that, you can specify the "default" name (for both index and search), or "default\_index" and "default\_search".
> 
> > Also, make sure, using the analyze API, that you are getting what you are after, since combining ngram withstemmingmight make little sense (especially with the default ngram settings).
> 
> > You can, if oyu want, have a multi\_field mapping, and have one mapping indexed using just ngram, and one with juststemming.
> 
> > -shay.banon
> 
> > On Wednesday, March 2, 2011 at 9:56 PM, Torsten wrote:
> > 
> > > Sure:[gist:851600 · GitHub](https://gist.github.com/851600)
> 
> > > On Mar 2, 1:41 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > > 
> > > > Cam you gist a curl recreation with the curl that created the index with the relevant mapping and analyzer config?
> 
> > > > On Tuesday, March 1, 2011 at 9:21 PM, Torsten wrote:
> > > > 
> > > > > Hello,
> 
> > > > > I am using Elasticsearch (0.15.0) as a search engine with full-text  
> > > > > search and word highlighting. It works but I'm not able to configure  
> > > > > an analyser with wordstemming.  
> > > > > I know that my problem is very similar to  
> > > > > [Why ElasticSearch is not finding my term - Stack Overflow](http://stackoverflow.com/questions/4981001/why-elasticsearch-is-not-f)....  
> > > > > I tried the suggested solution but  
> > > > > it still doesn't work.
> 
> > > > > My cluster metadata looks like this:  
> > > > > metadata: {  
> > > > > templates: { }  
> > > > > indices: {  
> > > > > test\_index: {  
> > > > > state: open  
> > > > > settings: {  
> > > > > index.analysis.filter.snowball.language: English  
> > > > > index.analysis.analyzer.search\_analyzer.filter.0:  
> > > > > lowercase  
> > > > > index.analysis.analyzer.search\_analyzer.filter.1:  
> > > > > snowball  
> > > > > index.analysis.analyzer.index\_analyzer.filter.0:  
> > > > > lowercase  
> > > > > index.analysis.filter.snowball.type: snowball  
> > > > > index.analysis.analyzer.search\_analyzer.tokenizer:  
> > > > > nGram  
> > > > > index.analysis.analyzer.index\_analyzer.tokenizer:  
> > > > > nGram  
> > > > > index.analysis.analyzer.index\_analyzer.filter.1:  
> > > > > snowball  
> > > > > index.number\_of\_shards: 5  
> > > > > index.number\_of\_replicas: 1  
> > > > > }  
> > > > > mappings: {  
> > > > > test\_item: {  
> > > > > properties: {  
> > > > > title: {  
> > > > > store: yes  
> > > > > analyzer: standard  
> > > > > term\_vector: with\_positions\_offsets  
> > > > > type: string  
> > > > > }  
> > > > > description: {  
> > > > > store: yes  
> > > > > analyzer: standard  
> > > > > term\_vector: with\_positions\_offsets  
> > > > > type: string  
> > > > > }  
> > > > > link: {  
> > > > > type: string  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > aliases:   
> > > > > }  
> > > > > }  
> > > > > }
> 
> > > > > And my query:  
> > > > > curl -XGET '[http://localhost:9200/\_search?pretty=true'-d'](http://localhost:9200/_search?pretty=true'-d')  
> > > > > {  
> > > > > "highlight": {  
> > > > > "tags\_schema": "styled",  
> > > > > "fields": {  
> > > > > "title": {  
> > > > > "number\_of\_fragments": 0  
> > > > > },  
> > > > > "description": {  
> > > > > "number\_of\_fragments": 0  
> > > > > }  
> > > > > }  
> > > > > },  
> > > > > "query": {  
> > > > > "query\_string": {  
> > > > > "fields" : ["title", "description"],  
> > > > > "query" : "apple" /\* finds entries with "apple", a search  
> > > > > with "apples" finds nothing \*/  
> > > > > }  
> > > > > }  
> > > > > }'
> 
> > > > > [ElasticSearch with stemming · GitHub](https://gist.github.com/849684)
> 
> > > > > Any hints? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![stelios](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@stelios](https://discuss.elastic.co/u/stelios)\
**Post date:** [March 3, 2011, 5:21pm UTC](https://discuss.elastic.co/t/elasticsearch-with-stemming-snwoball/4005/7 "2011-03-03T17:21:37Z")

</div>

that would be great 🙂

---

<div class="post-metadata">

**Author:** ![Torsten](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@Torsten](https://discuss.elastic.co/u/Torsten)\
**Post date:** [March 4, 2011, 1:41am UTC](https://discuss.elastic.co/t/elasticsearch-with-stemming-snwoball/4005/8 "2011-03-04T01:41:45Z")

</div>

Hi Rick,

of course, I'm glad if I can help. 🙂

Disclaimer: I am new to ES/Lucene and have no experience with it.  
Therefore it is quite possible that some settings are wrong or don't  
make sense.

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

On Mar 3, 6:04 pm, Rich Kroll [kroll.r...@gmail.com](mailto:kroll.r...@gmail.com) wrote:

> Torsten,  
> Can you gist your config so that others stumbling on this thread can  
> see what the proper mapping looks like? This seems to be a recurring  
> issue for people (myself included), so it would be great to have an  
> example of how to properly configure this.
> 
> Thanks!
> 
> Rich
> 
> On Mar 2, 7:49 pm, Torsten [admiralc...@gmail.com](mailto:admiralc...@gmail.com) wrote:
> 
> > Now it works, thanks a lot for your help!
> 
> > On Mar 3, 12:01 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > > Heya,
> 
> > > You don't specify the analyzer setting in the mapping, and the `index_analyzer` and `search_analyzer` do not control the default analyzers to be used in mappings case when none is specified. For that, you can specify the "default" name (for both index and search), or "default\_index" and "default\_search".
> 
> > > Also, make sure, using the analyze API, that you are getting what you are after, since combining ngram withstemmingmight make little sense (especially with the default ngram settings).
> 
> > > You can, if oyu want, have a multi\_field mapping, and have one mapping indexed using just ngram, and one with juststemming.
> 
> > > -shay.banon
> 
> > > On Wednesday, March 2, 2011 at 9:56 PM, Torsten wrote:
> > > 
> > > > Sure:[gist:851600 · GitHub](https://gist.github.com/851600)
> 
> > > > On Mar 2, 1:41 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > > > 
> > > > > Cam you gist a curl recreation with the curl that created the index with the relevant mapping and analyzer config?
> 
> > > > > On Tuesday, March 1, 2011 at 9:21 PM, Torsten wrote:
> > > > > 
> > > > > > Hello,
> 
> > > > > > I am using Elasticsearch (0.15.0) as a search engine with full-text  
> > > > > > search and word highlighting. It works but I'm not able to configure  
> > > > > > an analyser with wordstemming.  
> > > > > > I know that my problem is very similar to  
> > > > > > [Why ElasticSearch is not finding my term - Stack Overflow](http://stackoverflow.com/questions/4981001/why-elasticsearch-is-not-f)....  
> > > > > > I tried the suggested solution but  
> > > > > > it still doesn't work.
> 
> > > > > > My cluster metadata looks like this:  
> > > > > > metadata: {  
> > > > > > templates: { }  
> > > > > > indices: {  
> > > > > > test\_index: {  
> > > > > > state: open  
> > > > > > settings: {  
> > > > > > index.analysis.filter.snowball.language: English  
> > > > > > index.analysis.analyzer.search\_analyzer.filter.0:  
> > > > > > lowercase  
> > > > > > index.analysis.analyzer.search\_analyzer.filter.1:  
> > > > > > snowball  
> > > > > > index.analysis.analyzer.index\_analyzer.filter.0:  
> > > > > > lowercase  
> > > > > > index.analysis.filter.snowball.type: snowball  
> > > > > > index.analysis.analyzer.search\_analyzer.tokenizer:  
> > > > > > nGram  
> > > > > > index.analysis.analyzer.index\_analyzer.tokenizer:  
> > > > > > nGram  
> > > > > > index.analysis.analyzer.index\_analyzer.filter.1:  
> > > > > > snowball  
> > > > > > index.number\_of\_shards: 5  
> > > > > > index.number\_of\_replicas: 1  
> > > > > > }  
> > > > > > mappings: {  
> > > > > > test\_item: {  
> > > > > > properties: {  
> > > > > > title: {  
> > > > > > store: yes  
> > > > > > analyzer: standard  
> > > > > > term\_vector: with\_positions\_offsets  
> > > > > > type: string  
> > > > > > }  
> > > > > > description: {  
> > > > > > store: yes  
> > > > > > analyzer: standard  
> > > > > > term\_vector: with\_positions\_offsets  
> > > > > > type: string  
> > > > > > }  
> > > > > > link: {  
> > > > > > type: string  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > aliases:   
> > > > > > }  
> > > > > > }  
> > > > > > }
> 
> > > > > > And my query:  
> > > > > > curl -XGET '[http://localhost:9200/\_search?pretty=true'-d'](http://localhost:9200/_search?pretty=true'-d')  
> > > > > > {  
> > > > > > "highlight": {  
> > > > > > "tags\_schema": "styled",  
> > > > > > "fields": {  
> > > > > > "title": {  
> > > > > > "number\_of\_fragments": 0  
> > > > > > },  
> > > > > > "description": {  
> > > > > > "number\_of\_fragments": 0  
> > > > > > }  
> > > > > > }  
> > > > > > },  
> > > > > > "query": {  
> > > > > > "query\_string": {  
> > > > > > "fields" : ["title", "description"],  
> > > > > > "query" : "apple" /\* finds entries with "apple", a search  
> > > > > > with "apples" finds nothing \*/  
> > > > > > }  
> > > > > > }  
> > > > > > }'
> 
> > > > > > [ElasticSearch with stemming · GitHub](https://gist.github.com/849684)
> 
> > > > > > Any hints? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Torsten](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@Torsten](https://discuss.elastic.co/u/Torsten)\
**Post date:** [March 4, 2011, 1:44am UTC](https://discuss.elastic.co/t/elasticsearch-with-stemming-snwoball/4005/9 "2011-03-04T01:44:23Z")

</div>

Hi Rich,

of course, I'm glad if I can help. 🙂

Disclaimer: I am new to ES/Lucene and have no experience with it.  
Therefore it is quite possible that some settings are wrong or don't  
make sense.

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

On Mar 3, 6:04 pm, Rich Kroll [kroll.r...@gmail.com](mailto:kroll.r...@gmail.com) wrote:

> Torsten,  
> Can you gist your config so that others stumbling on this thread can  
> see what the proper mapping looks like? This seems to be a recurring  
> issue for people (myself included), so it would be great to have an  
> example of how to properly configure this.
> 
> Thanks!
> 
> Rich
> 
> On Mar 2, 7:49 pm, Torsten [admiralc...@gmail.com](mailto:admiralc...@gmail.com) wrote:
> 
> > Now it works, thanks a lot for your help!
> 
> > On Mar 3, 12:01 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > > Heya,
> 
> > > You don't specify the analyzer setting in the mapping, and the `index_analyzer` and `search_analyzer` do not control the default analyzers to be used in mappings case when none is specified. For that, you can specify the "default" name (for both index and search), or "default\_index" and "default\_search".
> 
> > > Also, make sure, using the analyze API, that you are getting what you are after, since combining ngram withstemmingmight make little sense (especially with the default ngram settings).
> 
> > > You can, if oyu want, have a multi\_field mapping, and have one mapping indexed using just ngram, and one with juststemming.
> 
> > > -shay.banon
> 
> > > On Wednesday, March 2, 2011 at 9:56 PM, Torsten wrote:
> > > 
> > > > Sure:[gist:851600 · GitHub](https://gist.github.com/851600)
> 
> > > > On Mar 2, 1:41 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > > > 
> > > > > Cam you gist a curl recreation with the curl that created the index with the relevant mapping and analyzer config?
> 
> > > > > On Tuesday, March 1, 2011 at 9:21 PM, Torsten wrote:
> > > > > 
> > > > > > Hello,
> 
> > > > > > I am using Elasticsearch (0.15.0) as a search engine with full-text  
> > > > > > search and word highlighting. It works but I'm not able to configure  
> > > > > > an analyser with wordstemming.  
> > > > > > I know that my problem is very similar to  
> > > > > > [Why ElasticSearch is not finding my term - Stack Overflow](http://stackoverflow.com/questions/4981001/why-elasticsearch-is-not-f)....  
> > > > > > I tried the suggested solution but  
> > > > > > it still doesn't work.
> 
> > > > > > My cluster metadata looks like this:  
> > > > > > metadata: {  
> > > > > > templates: { }  
> > > > > > indices: {  
> > > > > > test\_index: {  
> > > > > > state: open  
> > > > > > settings: {  
> > > > > > index.analysis.filter.snowball.language: English  
> > > > > > index.analysis.analyzer.search\_analyzer.filter.0:  
> > > > > > lowercase  
> > > > > > index.analysis.analyzer.search\_analyzer.filter.1:  
> > > > > > snowball  
> > > > > > index.analysis.analyzer.index\_analyzer.filter.0:  
> > > > > > lowercase  
> > > > > > index.analysis.filter.snowball.type: snowball  
> > > > > > index.analysis.analyzer.search\_analyzer.tokenizer:  
> > > > > > nGram  
> > > > > > index.analysis.analyzer.index\_analyzer.tokenizer:  
> > > > > > nGram  
> > > > > > index.analysis.analyzer.index\_analyzer.filter.1:  
> > > > > > snowball  
> > > > > > index.number\_of\_shards: 5  
> > > > > > index.number\_of\_replicas: 1  
> > > > > > }  
> > > > > > mappings: {  
> > > > > > test\_item: {  
> > > > > > properties: {  
> > > > > > title: {  
> > > > > > store: yes  
> > > > > > analyzer: standard  
> > > > > > term\_vector: with\_positions\_offsets  
> > > > > > type: string  
> > > > > > }  
> > > > > > description: {  
> > > > > > store: yes  
> > > > > > analyzer: standard  
> > > > > > term\_vector: with\_positions\_offsets  
> > > > > > type: string  
> > > > > > }  
> > > > > > link: {  
> > > > > > type: string  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > aliases:   
> > > > > > }  
> > > > > > }  
> > > > > > }
> 
> > > > > > And my query:  
> > > > > > curl -XGET '[http://localhost:9200/\_search?pretty=true'-d'](http://localhost:9200/_search?pretty=true'-d')  
> > > > > > {  
> > > > > > "highlight": {  
> > > > > > "tags\_schema": "styled",  
> > > > > > "fields": {  
> > > > > > "title": {  
> > > > > > "number\_of\_fragments": 0  
> > > > > > },  
> > > > > > "description": {  
> > > > > > "number\_of\_fragments": 0  
> > > > > > }  
> > > > > > }  
> > > > > > },  
> > > > > > "query": {  
> > > > > > "query\_string": {  
> > > > > > "fields" : ["title", "description"],  
> > > > > > "query" : "apple" /\* finds entries with "apple", a search  
> > > > > > with "apples" finds nothing \*/  
> > > > > > }  
> > > > > > }  
> > > > > > }'
> 
> > > > > > [ElasticSearch with stemming · GitHub](https://gist.github.com/849684)
> 
> > > > > > Any hints? Thanks in advance!

---

<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:10am UTC](https://discuss.elastic.co/t/elasticsearch-with-stemming-snwoball/4005/10 "2017-07-06T04:10:54Z")

</div>


