Hi all,
A while ago, I needed to find documents that a certain term(word) is repeated twice or more in a certain field of those documents. Some queries like Match
query doesn't work in such situations as they just check whether any word of search text exists in document field or not. Therefore, I had to use match_phrase
query as it also allows the words of search text to be in any order which was really important to me.
The problem is that I need to include fuzziness in my search query explained above and unfortunately, match_phrase
query doesn't support fuzziness. According to my Google searches, everyone recommends using span_near
query rather than match_phrase
for this purpose and it works for normal cases very well, but when there are duplicate words in search text, it seems span_near
is not able to match any word in search text individually. Please note that I have to use span_near
query with "slop": 50
and "in_order": false
to achieve the functionality just like what match_phrase
query provides. If I'm wrong, please let me know.
Does anyone know how I can achieve Match Phrase
behaviour along with fuzziness without using span_near
query? Any help would be much appreciated.