I have a query to search for an address where I am using also the wildcard. So if I am searching for Kennedy
using the query below, I have these addresses:
Query:
GET my_index/_search
{
"query": {
"query_string": {
"default_field": "address",
"query": "Kennedy*",
"rewrite": "scoring_boolean"
}
}
}
Result
"address" : "Kennedydamm 24, 40476 Düsseldorf, Deutschland"
"address" : "Kennedy-Ufer 2a, 50679 Köln, Deutschland"
"address" : "Kennedyallee 62-70, 53175 Bonn, Deutschland"
"address" : "Kennedyallee 70, 60596 Frankfurt am Main, Deutschland"
"address" : "46a Av. John F. Kennedy, 1855 Luxembourg, Luxemburg"
"address" : "35 Av. John F. Kennedy, 1855 Luxembourg, Luxemburg"
"address" : "44 Av. John F. Kennedy, 1855 Luxembourg, Luxemburg"
But on top of that I want to add the fuzziness, so let's say we have this misspelling Kennady
and we try the same query above, it returns nothing.
I tried addying the fuzziness like this:
GET my_index/_search
{
"query": {
"query_string": {
"default_field": "address",
"query": "Kennady~",
"rewrite": "scoring_boolean"
}
}
}
but, it returns to me only the 4 addresses below:
"address" : "Kennedy-Ufer 2a, 50679 Köln, Deutschland"
"address" : "46a Av. John F. Kennedy, 1855 Luxembourg, Luxemburg"
"address" : "35 Av. John F. Kennedy, 1855 Luxembourg, Luxemburg"
"address" : "44 Av. John F. Kennedy, 1855 Luxembourg, Luxemburg"
so addresses that are like Kennedydamm
and Kennedyallee
are missing.
I tried to combined like this:
GET my_index/_search
{
"query": {
"query_string": {
"default_field": "address",
"query": "Kennady~*",
"rewrite": "scoring_boolean"
}
}
}
but it returns all the addresses, I mean all the documents, which is something I don't want.
So how we can combine wildcard and fuzziness in this case?