"When querying text
or keyword
fields, fuzziness
is interpreted as a Levenshtein Edit Distance"
Based on the above statement from Fuzziness Document, the query should work the same for both fields.
Please correct me if I'm wrong
here is how the Mapping goes, copying the same data to keyword field and text field
"properties":{
"id":{"type":"keyword"},
"name":{"type":"keyword", "copy_to": ["name_factor_k", "name_factor_t"]},
"accNames": {"type":"keyword", "copy_to": ["name_factor_k", "name_factor_t"]},
"name_factor_k": {"type":"keyword"},
"name_factor_t": {"type":"text"}
}
Here is how my Query goes.
Query 1 with Keyword Field
"query": {
"match": {
"name_factor_k": {
"query": "youtube",
"fuzziness": "AUTO",
"operator": "AND"
}
}
}
Query 2 with Text Field
"query": {
"match": {
"name_factor_t": {
"query": "youtube",
"fuzziness": "AUTO",
"operator": "AND"
}
}
}
I'm expecting same result for both query but only byText field is returning right result.
FYI:-
accNames: [ "YOUTUBE INC.", "GOOGLE WEB", "ALPHABET" and so on]