# edgeNGram filter not keeping the whole words

**URL:** <https://discuss.elastic.co/t/edgengram-filter-not-keeping-the-whole-words/12951>\
**Category:** Elasticsearch\
**Created:** [July 26, 2013, 8:31am UTC](https://discuss.elastic.co/t/edgengram-filter-not-keeping-the-whole-words/12951 "2013-07-26T08:31:35Z")\
**Posts on this page:** 3\
**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:** [July 26, 2013, 8:31am UTC](https://discuss.elastic.co/t/edgengram-filter-not-keeping-the-whole-words/12951/1 "2013-07-26T08:31:35Z")

</div>

Hi guys, I have a problem with my analyzer. Following is the setup in  
elasticsearch.yml:  
analyzer :  
default\_index :  
type : custom  
tokenizer : whitespace  
filter : [word\_delimiter, asciifolding, standard,  
lowercase, synonym, edgeNGram]  
filter :  
word\_delimiter :  
type : word\_delimiter  
preserve\_original : true  
edgeNGram :  
type : edgeNGram  
min\_gram : 2  
max\_gram : 15  
side : front

The problem is that when I run curl -XGET  
'localhost:9200/my\_index/\_analyze?field=email\_doc.body' -d  
'WordWithOverFifteenChars', the result is 'WordWithOverFifteenChars' broken  
down into n-grams up to 15 chars, but the whole word does not get indexed.  
The same happens for words like 'something.company', that means the whole  
world (preserve\_orginal settings for word\_delimiter filter) doesn't get  
preserved, it only gets broken down into n-grams as a whole up to  
'something.compa' (15 chars) as well as n-grams for 'company' and  
'something' are created.  
Could you give me your insight on what I am missing?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [July 26, 2013, 9:20am UTC](https://discuss.elastic.co/t/edgengram-filter-not-keeping-the-whole-words/12951/2 "2013-07-26T09:20:51Z")

</div>

Hi,

Although preserve\_original is set to true on the word\_delimiter filter, the  
edgeNGram filter is applied afterwards, meaning that the analyzer will  
compute n-grams for both the original word and the sub-words created by the  
word\_delimiter filter.

If you want to keep the original token, it might make sense to use a multi  
field[1] and analyze your field once with word\_delimiter and once with  
n-grams. Then you can use any of those fields depending on what you are  
trying to achieve : prefix search with the field analyzed with edgeNGram  
and standard search with the field analyzed with word\_delimiter.

[1] [http://www.elasticsearch.org/guide/reference/mapping/multi-field-type/](http://www.elasticsearch.org/guide/reference/mapping/multi-field-type/)

--  
Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_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:** [July 6, 2017, 2:24am UTC](https://discuss.elastic.co/t/edgengram-filter-not-keeping-the-whole-words/12951/3 "2017-07-06T02:24:23Z")

</div>


