I'm trying to make sure that when the city is incompletely written, I get an approximately suitable list.
Example: i request with value "San" and take response "San Diego", "San Jose", "San Francisco", "Santa Rosa", "Santa Maria"
Now: i request with value "Masc" and take response nothing, but if request "Mascow" my response "Moscow"
Fuzzy search will only help you match where there's max 2 characters different between search term and indexed term.
To match "San" with "San Diego" in the city field it sounds like you want to use a prefix query and to use a keyword field with a lower case normalizer.
Just week ago i created index and my full address have city, street, number house (example: Moscow, str. Avtozavodskay, h. 26). My request with "avtozav" and he returned full address (look example)
If we are to diagnose any problems we need JSON examples for a mapping, document and search otherwise we can't reproduce what is being discussed and be certain of what problem might exist.
POST addresses/_doc/1
{
"address": "Moscow, str. Avtozavodskay, h. 26"
}
POST addresses/_doc/2
{
"address": "Moscow, str. Avtozavodskay, h. 32"
}
POST addresses/_doc/3
{
"address": "Moscow, str. Lenina, h. 1"
}
Your settings for the analyzer look messed up.
Also, as I stated earlier, a max of 2 character differences are permitted between search term and indexed term so a search for avtozavod will not match avtozavodskay because that is 4 characters different. In the example below I have a 2 character difference and it works:
PUT /addresses
{
"mappings": {
"properties": {
"address": { "type": "text", "analyzer": "russian" }
}
}
}
POST addresses/_doc/1
{
"address": "Moscow, str. Avtozavodskay, h. 26"
}
POST addresses/_doc/2
{
"address": "Moscow, str. Avtozavodskay, h. 32"
}
POST addresses/_doc/3
{
"address": "Moscow, str. Lenina, h. 1"
}
POST /addresses/_search
{
"query": {
"match": {
"address": {
"query": "stz avtozavodskzz",
"fuzziness": "auto",
"operator": "and"
}
}
}
}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.