# exactMatchFirst in Elastic with edge-ngram analyser

**URL:** <https://discuss.elastic.co/t/exactmatchfirst-in-elastic-with-edge-ngram-analyser/127265>\
**Category:** Elasticsearch\
**Created:** [April 9, 2018, 7:32am UTC](https://discuss.elastic.co/t/exactmatchfirst-in-elastic-with-edge-ngram-analyser/127265 "2018-04-09T07:32:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deepak\_r\_kiran](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@Deepak\_r\_kiran](https://discuss.elastic.co/u/Deepak_r_kiran)\
**Post date:** [April 9, 2018, 7:32am UTC](https://discuss.elastic.co/t/exactmatchfirst-in-elastic-with-edge-ngram-analyser/127265/1 "2018-04-09T07:32:26Z")

</div>

As per example posted in elastic website, it won't return the result with "exactMatchFirst ",  
What should be included in the query?. I have played around "minimum\_should\_match" but  
when its value is 100% then only exact value return or nothing return. I am looking for a solution when minimum\_should\_match would be 98-99% but result should be in order by exactMatchFirst.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 9, 2018, 7:52am UTC](https://discuss.elastic.co/t/exactmatchfirst-in-elastic-with-edge-ngram-analyser/127265/2 "2018-04-09T07:52:17Z")

</div>

Hey,

I am not sure I fully understand the use-case (please supply a full reproducible example to ensure there are no ambiguities), but have you tried to wrap your current query into a [bool query](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/query-dsl-bool-query.html) in the `must` clause and then add a `should` clause for the exact match to increase scoring?

--Alex

---

<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:** [May 7, 2018, 7:52am UTC](https://discuss.elastic.co/t/exactmatchfirst-in-elastic-with-edge-ngram-analyser/127265/3 "2018-05-07T07:52:21Z")

</div>

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