MatchQuery - Identify fuzziness

.net

#1

Dear All,

I’ve created a simple MatchQuery to try out fuzzy queries. Can I somehow identify if the match was exact or non-exact?

Thanks,
Best regards,
Imre


#2

@abhinav - can you help here?


#3

@imre.g.kovacs Unfortunately, there isn’t a way to differentiate an exact match from a non-exact match with fuzzy queries.

When you set fuzziness to some value, all the possible candidate terms over you’re match term with the set fuzziness are determined after which a disjunction query ensues over all those candidate terms.

But that said, you can change the ordering of your results by applying boosting to ensure exact matches carry a higher score than others this way:

curl -XPOST -H "Content-type: application/json" http://<username>:<password>@<ip>:<port>/api/index/<indexname>/query -d '{"query":{"disjuncts":[{"match": "<term>", "boost": 2},{"match": "<term>", "fuzziness": 1}]}}'

#4

Thank you for your response! I really appreciate your help!