# Match\_phrase with a fixed word sequence?

**URL:** <https://discuss.elastic.co/t/match-phrase-with-a-fixed-word-sequence/1015>\
**Category:** Elasticsearch\
**Created:** [May 20, 2015, 5:54pm UTC](https://discuss.elastic.co/t/match-phrase-with-a-fixed-word-sequence/1015 "2015-05-20T17:54:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobchou9](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@bobchou9](https://discuss.elastic.co/u/bobchou9)\
**Post date:** [May 20, 2015, 5:54pm UTC](https://discuss.elastic.co/t/match-phrase-with-a-fixed-word-sequence/1015/1 "2015-05-20T17:54:00Z")

</div>

Hi there, when I try to use "match\_phrase" and "slop" to query a phrase, the sequence of words is not fixed, for example, if I search "quick fox" with slop 2, it will match either "quick brown fox" or "fox brown quick", but I only wanna "quick brown fox" as my result ..so is there any solution for making the words sequence fixed when I searching a phrase? thanks!

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [May 20, 2015, 6:27pm UTC](https://discuss.elastic.co/t/match-phrase-with-a-fixed-word-sequence/1015/2 "2015-05-20T18:27:15Z")

</div>

There is a query in lucene like this but it isn't exposed to elasticsearch:

> **[A new proximity query for Lucene, using automatons](http://blog.mikemccandless.com/2014/08/a-new-proximity-query-for-lucene-using.html?m=1)**
>
> The simplest Apache Lucene query, TermQuery , matches any document that contains the specified term, regardless of where the term occurs i...

You could try a slop of 1 but I don't think that is what you want.

---

<div class="post-metadata">

**Author:** ![bobchou9](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@bobchou9](https://discuss.elastic.co/u/bobchou9)\
**Post date:** [May 20, 2015, 6:35pm UTC](https://discuss.elastic.co/t/match-phrase-with-a-fixed-word-sequence/1015/3 "2015-05-20T18:35:09Z")

</div>

Thanks for the quick reply! I will take a look about this lucene query..you are right, slop 1 is not what I need, and even use slop 1, the sequence also is not fixed..

---

<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, 12:12am UTC](https://discuss.elastic.co/t/match-phrase-with-a-fixed-word-sequence/1015/4 "2017-07-06T00:12:58Z")

</div>


