# edgeNGram weirdness

**URL:** <https://discuss.elastic.co/t/edgengram-weirdness/9371>\
**Category:** Elasticsearch\
**Created:** [October 16, 2012, 8:38am UTC](https://discuss.elastic.co/t/edgengram-weirdness/9371 "2012-10-16T08:38:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Axsuul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axsuul/32/2663_2.png) [@Axsuul](https://discuss.elastic.co/u/Axsuul)\
**Post date:** [October 16, 2012, 8:38am UTC](https://discuss.elastic.co/t/edgengram-weirdness/9371/1 "2012-10-16T08:38:54Z")

</div>

Hi,

I'm having trouble getting a edgengram query to behave properly. I have one  
record "blue grass" with an edgengram minimum of 2. A query string of "blv"  
however returns "blue grass" although it shouldn't.

curl -X POST [http://localhost:9200/test](http://localhost:9200/test) -d '{  
"mappings": {  
"product/fragrance": {  
"properties": {  
"name\_query": {  
"index\_analyzer": "query\_index\_analyzer",  
"search\_anaylzer": "query\_search\_analyzer",  
"as": {},  
"type": "string"  
}  
}  
}  
},  
"settings": {  
"analysis": {  
"filter": {  
"query\_edgengram": {  
"type": "edgeNGram",  
"min\_gram": 2,  
"max\_gram": 20,  
"side": "front"  
}  
},  
"analyzer": {  
"query\_index\_analyzer": {  
"tokenizer": "lowercase",  
"filter": ["asciifolding", "query\_edgengram"]  
},  
"query\_search\_analyzer": {  
"tokenizer": "lowercase",  
"filter": ["asciifolding"]  
}  
}  
}  
}  
}'

curl -X POST "[http://localhost:9200/test/product%2Ffragrance/1](http://localhost:9200/test/product%2Ffragrance/1)" -d '{  
"name\_query": "blue grass"  
}'

curl -X GET "  
[http://localhost:9200/test/product%2Ffragrance/\_search?load=true&pretty=true](http://localhost:9200/test/product%2Ffragrance/_search?load=true&pretty=true)"  
-d '{  
"query": {  
"bool": {  
"must": [{  
"query\_string": {  
"query": "blv",  
"fields": ["name\_query"],  
"default\_operator": "OR"  
}  
}]  
}  
}  
}'

For some reason, I get a result from that. Can anyone explain why? Thanks.  
What I want to happen is "blv" shouldn't be returning "blue grass" although  
"bl" should. I've used the analyze API and see "blue grass" being broken  
down to "bl", "blu", "blue", "gr", "gra", "gras", "grass" but "blv" doesn't  
match any of those.

--

---

<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, 3:08am UTC](https://discuss.elastic.co/t/edgengram-weirdness/9371/2 "2017-07-06T03:08:37Z")

</div>

Closed on July 6, 2017, 3:08am UTC


