My use case is to have multiple phrases/words highlighted in a field that is retrieved based on fuzzy and prefix matching. For this I have currently used span_near to handle phrases and span_multi for allowing the use for fuzziness in my phrase terms. I also need to use prefix_length so fuzzy is only allowed for the characters after prefix match but span_multi does not allow more than one multi term query. Is there any other way this can be done?
"query":{
"bool":{
"should":[{
"span_near": {
"clauses": [
{
"span_multi": {
"match": {
"fuzzy": {
"comment": {
"fuzziness": "5",
"value": "Beata"
}
}
}
}
},
{
"span_multi": {
"match": {
"fuzzy": {
"comment": {
"fuzziness": "5",
"value": "Rosenane"
}
}
}
}
}
],
"in_order": False,
}},{
"span_near": {
"clauses": [
{
"span_multi": {
"match": {
"fuzzy": {
"comment": {
"fuzziness": "5",
"value": "Christna"
}
}
}
}
}
],
"in_order": False,
}}]
}
},
"highlight" : {
"fields" : {
"comment" : { "pre_tags" : ["<temp>"], "post_tags" : ["</temp>"],
"number_of_fragments" : 0
}
}
}
}
Hey so it was working with
"comment": {
"fuzziness": "5",
"value": "Rosenane",
"prefix_match":3
}