# Elasticsearch query result order based on matching position

**URL:** <https://discuss.elastic.co/t/elasticsearch-query-result-order-based-on-matching-position/196450>\
**Category:** Elasticsearch\
**Created:** [August 23, 2019, 6:01am UTC](https://discuss.elastic.co/t/elasticsearch-query-result-order-based-on-matching-position/196450 "2019-08-23T06:01:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PrasathRajan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prasathrajan/32/52874_2.png) [@PrasathRajan](https://discuss.elastic.co/u/PrasathRajan)\
**Post date:** [August 23, 2019, 6:01am UTC](https://discuss.elastic.co/t/elasticsearch-query-result-order-based-on-matching-position/196450/1 "2019-08-23T06:01:09Z")

</div>

I have two sentences.

1. Model text
2. Jug Model

if I query for 'model' or 'del' result is coming in below order

1. Jug Model
2. Model Text

Is there any way I can get "Model Text" first, since its the best match. I know about edge\_ngram. but here requirement is, user may type text in the middle also like "del" and the result should be in same order.

Any help would be appreciated. Thanks

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [August 30, 2019, 1:44pm UTC](https://discuss.elastic.co/t/elasticsearch-query-result-order-based-on-matching-position/196450/2 "2019-08-30T13:44:05Z")

</div>

Could you describe the model that you have in mind in more details with more examples? I am not really sure what you are trying to achieve here. Can you have more than 2 words? How matching the second word in more than one record would work?

---

<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:** [September 27, 2019, 1:44pm UTC](https://discuss.elastic.co/t/elasticsearch-query-result-order-based-on-matching-position/196450/3 "2019-09-27T13:44:16Z")

</div>

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