# Removing last letter of a word - but only some words?

**URL:** <https://discuss.elastic.co/t/removing-last-letter-of-a-word-but-only-some-words/115499>\
**Category:** Elasticsearch\
**Created:** [January 15, 2018, 8:50am UTC](https://discuss.elastic.co/t/removing-last-letter-of-a-word-but-only-some-words/115499 "2018-01-15T08:50:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smhoeks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smhoeks/32/23395_2.png) [@smhoeks](https://discuss.elastic.co/u/smhoeks)\
**Post date:** [January 15, 2018, 8:50am UTC](https://discuss.elastic.co/t/removing-last-letter-of-a-word-but-only-some-words/115499/1 "2018-01-15T08:50:15Z")

</div>

Hi there, elastic-people 🙂

Im new to Elastic, basically working on already implemented settings, where i try to adapt index-setting to my needs.

Right now im working specific with an elasticsearch-extension from Mirasvit (Elasticsuite Ultimate) for Magento 2 - and here i right now face a problem with my search - specific with the last letter on some of the words in my search.

Here a short brief of what im experiencing at the moment:  
URL: [mikrolab.phhw-131201.cust.powerhosting.dk](http://mikrolab.phhw-131201.cust.powerhosting.dk)

I can find results when searching for:  
Pumpeslange  
Indsats  
Skruelågsgla (When you use autocomplete, you can see there's lots of products showing names with "Skruelågsglas")

But when i add "an ending" (primarily in plural) - the search won't return any products even though productname or one of my searchable attribute definitely has the exact word.  
E.g.:  
Pumpeslanger ('r' makes it plural)  
Indsatse ('e' makes it plural)  
Skruelågsglas (Here, its actually just the correct word)

The current index-settings are right now:  
'analysis' =\> [  
'analyzer' =\> [  
'custom' =\> [  
'type' =\> 'custom',  
'tokenizer' =\> 'whitespace',  
'filter' =\> [  
'word',  
'lowercase',  
'local\_stemmer', (OBS: Sets danish\_analyzer for my danish-storeview)  
],  
],  
],  
'filter' =\> [  
'local\_stemmer' =\> [  
'type' =\> 'stemmer',  
'language' =\> $this-\>config-\>getStemmer($dimension),  
],  
'word' =\> [  
'type' =\> 'word\_delimiter',  
'generate\_word\_parts' =\> false,  
'generate\_number\_parts' =\> false,  
'catenate\_words' =\> false,  
'catenate\_numbers' =\> false,  
'catenate\_all' =\> false,  
'split\_on\_case\_change' =\> false,  
'preserve\_original' =\> true,  
'split\_on\_numerics' =\> false,  
'stem\_english\_possessive' =\> false,  
],  
],  
],  
],  
],

Furthermore, i've set up a an regex-expression for my search to:  
Match expression: /[a-z]_[-][0-9]_/i  
Replace expression: /[-]/

This is to make it possible to find my SKU-numbers with/without use of space - but this doesn't seem to be the issue based on my tests.

Hoping you guys can help me out.

Kindly regards  
Søren

---

<div class="post-metadata">

**Author:** ![s1monw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s1monw/32/3637_2.png) [@s1monw](https://discuss.elastic.co/u/s1monw)\
**Post date:** [January 19, 2018, 1:37pm UTC](https://discuss.elastic.co/t/removing-last-letter-of-a-word-but-only-some-words/115499/2 "2018-01-19T13:37:32Z")

</div>

I can see that you have already configured a stemmer which should do what you want. Do you query the correct field an can you maybe run an [explain](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html) query to show what happens to the query terms

---

<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:** [February 16, 2018, 1:38pm UTC](https://discuss.elastic.co/t/removing-last-letter-of-a-word-but-only-some-words/115499/3 "2018-02-16T13:38:14Z")

</div>

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