# Query\_string on n-gram field

**URL:** <https://discuss.elastic.co/t/query-string-on-n-gram-field/65557>\
**Category:** Elasticsearch\
**Created:** [November 9, 2016, 9:04pm UTC](https://discuss.elastic.co/t/query-string-on-n-gram-field/65557 "2016-11-09T21:04:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ugolas](https://avatars.discourse-cdn.com/v4/letter/u/7993a0/32.png) [@ugolas](https://discuss.elastic.co/u/ugolas)\
**Post date:** [November 9, 2016, 9:04pm UTC](https://discuss.elastic.co/t/query-string-on-n-gram-field/65557/1 "2016-11-09T21:04:26Z")

</div>

Hi all,

I'm trying to use a query\_string on a field which has a n-gram analyzer, this is the behavior i'm seeing:

Assuming my doc contains the field:  
"my\_field": "abcd"

the nGram tokenizer is configured:  
"min\_gram" : "3",  
"max\_gram" : "3"

And the query\_string input is: "abc" results in the desired doc.

BUT,  
Searching for "abce" also returns the doc with "abcd"!

Is there a way to do searches on n-gram fields that return only 100% match on the input, so that 'abc', 'abcd' will return the doc, but 'abce' won't?

---

<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:** [December 7, 2016, 9:04pm UTC](https://discuss.elastic.co/t/query-string-on-n-gram-field/65557/2 "2016-12-07T21:04:38Z")

</div>

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