Reputation: 333
So i saw these two queries. First one is match with fuzziness option
{
"query": {
"match": {
"user": {
"query": "ki",
"fuzziness": "AUTO"
}
}
}
}
Second one is normal fuzzy search
{
"query": {
"fuzzy": {
"user": {
"value": "ki"
}
}
}
}
Result is pretty much the same. But my question is, does the query really does the same structure? and which one to use for fuzziness best practice?
Upvotes: 1
Views: 2842
Reputation: 1691
In your example the results are the same. However, the fuzzy query behaves like a term query, so it does not perform analysis beforehand, whereas the match query does.
So if you searched for an address field containing pigeon street
and indexed with a standard analyser, this query would work
GET my-index/_search
{
"query": {
"match": {
"address": {
"query": "wigeon street",
"fuzziness": 1
}
}
}
}
but this one would not:
GET my-index/_search
{
"query": {
"fuzzy": {
"address": {
"value": "wigeon street"
}
}
}
}
Upvotes: 3