# Snowball Analyzer not working in Elasticsearch 5.0

**URL:** <https://discuss.elastic.co/t/snowball-analyzer-not-working-in-elasticsearch-5-0/70285>\
**Category:** Elasticsearch\
**Created:** [December 30, 2016, 4:11pm UTC](https://discuss.elastic.co/t/snowball-analyzer-not-working-in-elasticsearch-5-0/70285 "2016-12-30T16:11:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![iluvcode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iluvcode/32/24929_2.png) [@iluvcode](https://discuss.elastic.co/u/iluvcode)\
**Post date:** [December 30, 2016, 4:11pm UTC](https://discuss.elastic.co/t/snowball-analyzer-not-working-in-elasticsearch-5-0/70285/1 "2016-12-30T16:11:24Z")

</div>

```
var result = ElasticClientSingleton.WriteInstance.CreateIndex(IndexName, d => d.Settings(s => s.
                            Analysis(a => a.
                            Analyzers(ad => ad.
                                Snowball("pluralwordsAnalyzer", descriptor => descriptor.
                                    Language(SnowballLanguage.English))
                            ))).
                            Mappings(dd => dd.Map<ItemSearchEntry>(m => m.AutoMap()
                                 .Properties(o => o.Text(mf => mf
                                         .Name(s => s.ShortDescription)
                                         .Index()
                                         .Fields(f => f
                                             .Text(s => s.Name(oo => oo.ShortDescription.Suffix("raw")).Index())
                                             .Text(s => s.Name(oo => oo.ShortDescription).SearchAnalyzer("pluralwordsAnalyzer").Analyzer("pluralwordsAnalyzer"))
                                            )
                                        )
                                     )
                                  )));

```

I am adding snowball analyzer at the time of Indexing records. When I search for apple, i get only 1 document and when I search for apples i get 3 documents. I should get 4 documents when i search for apple or apples. Not sure where I am going wrong.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [December 30, 2016, 5:48pm UTC](https://discuss.elastic.co/t/snowball-analyzer-not-working-in-elasticsearch-5-0/70285/2 "2016-12-30T17:48:52Z")

</div>

Can you reproduce with curl or CONSOLE syntax? I can probably puzzle out what the client is doing but it'd be useful to remove it from the equation.

---

<div class="post-metadata">

**Author:** ![iluvcode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iluvcode/32/24929_2.png) [@iluvcode](https://discuss.elastic.co/u/iluvcode)\
**Post date:** [December 30, 2016, 8:01pm UTC](https://discuss.elastic.co/t/snowball-analyzer-not-working-in-elasticsearch-5-0/70285/3 "2016-12-30T20:01:38Z")

</div>

@nik9000  
below is my indexing query.

```
{
    	"settings": {
    		"analysis": {
    			"analyzer": {
    				"pluralwordsAnalyzer": {
    					"type": "snowball",
    					"language": "English"
    				}
    			}
    		}
    	},
    	"mappings": {
    		"smartsiteitemsearchentry": {
    			"properties": {
    				"itemId": {
    					"type": "integer"
    				},
    				"shortDescription": {
    					"type": "text",
    					"fields": {
    						"shortDescription": {
    							"type": "text",
    							"analyzer": "pluralwordsAnalyzer",
    							"search_analyzer": "pluralwordsAnalyzer"
    						}
    					}
    				},
    				"searchTerm": {
    					"fields": {
    						"keyword": {
    							"ignore_above": 256,
    							"type": "keyword"
    						}
    					},
    					"type": "text"
    				}
    			}
    		}
    	}
    }

```

My search query:

```
{
	"from": 0,
	"size": 100,
	"sort": [{
		"rank": {
			"order": "desc"
		}
	}],
	"query": {
		"bool": {
			"filter": [{
				"match": {
					"shortDescription": {
						"query": "apple",
						"minimum_should_match": 1
					}
				}
			}]
		}
	}
}
```

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [December 30, 2016, 8:51pm UTC](https://discuss.elastic.co/t/snowball-analyzer-not-working-in-elasticsearch-5-0/70285/4 "2016-12-30T20:51:58Z")

</div>

[This](https://gist.github.com/nik9000/2132cee6ae280b8c56b473aa6685ab08) works for me. If you change the search field from `shortDescription` to `shortDescription.shortDescription` then yours ought to work. You may want to call the sub-field that is analyzed using the plural analyzer something different so it isn't confusing though.

---

<div class="post-metadata">

**Author:** ![iluvcode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iluvcode/32/24929_2.png) [@iluvcode](https://discuss.elastic.co/u/iluvcode)\
**Post date:** [December 30, 2016, 9:23pm UTC](https://discuss.elastic.co/t/snowball-analyzer-not-working-in-elasticsearch-5-0/70285/5 "2016-12-30T21:23:36Z")

</div>

@nik9000  
Damn, I made a silly mistake in the query. Thanks for pointing 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:** [January 27, 2017, 9:24pm UTC](https://discuss.elastic.co/t/snowball-analyzer-not-working-in-elasticsearch-5-0/70285/6 "2017-01-27T21:24:27Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
