I have a query that works decently well on a product catalog. My query currently utilizes fuzziness in the multi_match, but I would prefer that the search utilized the fuzziness option if the same query (without fuzziness) didn't return any results. Is this possible to do within the query? (Using Rails 5)
Here is my current query:
@products = Product.search(
query:{
function_score:{
query:{
bool:{
must:{
multi_match:{
fields: ['brand^10', '_all'],
query: "#{query}",
fuzziness: "AUTO"
}
},
filter:{
bool:{
must:filters
}
}
}
},
field_value_factor:{
field: "popularity",
modifier: "log1p",
factor: 0.5
},
boost_mode: "sum"
}
}).page(page).per(25)