I am using ElasticSearch and I am trying to implement match_phrase/string + fuzziness but it seems like it is impossible (not that much examples online, no such cases in the documentation).
What I need: phrase/string matching + fuzziness + slop based on every value of the field individually.
What I've tried so far (and I still don't have a solution I need):
query_string - it has fuzziness and slop included. However, it gathers a string through all of the values of the field through one document.
match_phrase - it has slop included, but there is no fuzziness. What is good - it looks for a phrase match in at least one of the values of the field, not gathers the string through all the values of the document's field.
What I need:
Anybody has experience on phrase matching including fuzziness on ElasticSearch?
Thanks in advance.
You can make use of Span Queries for this as I've mentioned in the links in the comment section of the question.
What you further looking for, is a way to control fuzziness using Span Queries. I've taken an example from this SOF answer and rewrote the query as you wanted to manage fuzziness.
POST <your_index_name>
{
"query":{
"bool":{
"must":[
{
"span_near":{
"clauses":[
{
"span_multi":{
"match":{
"fuzzy":{
"name":{
"value":"champions",
"fuzziness":2
}
}
}
}
},
{
"span_multi":{
"match":{
"fuzzy":{
"name":{
"value":"league",
"fuzziness":2
}
}
}
}
}
],
"slop":0,
"in_order":false
}
}
]
}
}
}
Hope this helps!