Match_phrase with a fixed word sequence?

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!

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

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

1 Like

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..