# Elasticsearch query by position of word

**URL:** <https://discuss.elastic.co/t/elasticsearch-query-by-position-of-word/76915>\
**Category:** Elasticsearch\
**Created:** [March 1, 2017, 5:14am UTC](https://discuss.elastic.co/t/elasticsearch-query-by-position-of-word/76915 "2017-03-01T05:14:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navneet\_Mathpal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/navneet_mathpal/32/3677_2.png) [@Navneet\_Mathpal](https://discuss.elastic.co/u/Navneet_Mathpal)\
**Post date:** [March 1, 2017, 5:14am UTC](https://discuss.elastic.co/t/elasticsearch-query-by-position-of-word/76915/1 "2017-03-01T05:14:44Z")

</div>

Hi ,

when search with elasticsearch based on inverted indexing .

let us suppose we have 2 docs 1- game of thrones and 2- ender's game  
when I am searching with game eaither game of thrones or ender's game will come first . I am using ngram tokenizer in index time and edgeNgram tokenizer at query time .

so for the auto complete when I am searching with "gam" -\> ender's game appears first . But I want game of thrones to come first because it matches first in doc . [both are in title]

so basically I want consider the order in which they appeat in doc.

example2 - 1- hello kitty , 2- kitty hello ..  
when I am searching with hello ,hello kitty should come first then kitty hello

Is there any query which uses the order of word ?

Thanks,  
Navneet

---

<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:** [March 29, 2017, 5:15am UTC](https://discuss.elastic.co/t/elasticsearch-query-by-position-of-word/76915/2 "2017-03-29T05:15:15Z")

</div>

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