How to combine proximity and fuziness in search queries


Hi, I am currently struggling to find a way to search for fuzzy phrases in elastaticsearch 5.x.

Let me give an example: Let's say I want to find fuzzy phrase "word1 word2". That means I want to find documents containing word1 and word2 or their fuzzy variants close to each other. Matching documents would be eg:

  1. "word1 word2"
  2. "word2 word1"
    but also 3. "wodr1 word2"
    or 4. "wrod2 word1"
    or 5. "word1 another-word word2"
    but not "word1 thousands-of-other-words word2"

I hope this explains well what kind of functionality I am looking for.

I know I can use "match_phrase" query with slop for proximity and "match" query for fuzziness. But I don't know how to combine them. I have studied plenty of elasticsearch DSL documentation without finding an answer.

I would be really glad if someone could help.



I think I've found an answer to my question here:

Basically, it says that fuzzy phrase search can be achieved by combining span queries with nested fuzzy query.

elasticsearch documentation says that "fuzzy" query will be removed in version 6.0 and recommends to use "match" query instead of it. However, "match" doesn't seem to be allowed inside spans. Is there going to be a replacement for this combination of spans&fuzzy in version 6.0?

(system) #3

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