HI,
Am trying to do a fuzzy search on the name field which has 2 words in it like
name : Residentie Verdé
search text : "Residentie Verd"
when i do the search i get all the matches of Residentie and all the matches of Verdé on top and then i get the fuzzy matches of Residentie Verd. Is there a way to get the results of both words on top.
the current sequence of my results is
"LEVERD ((LE-VERD))"
"VERD-INVEST"
"Residentie Golfgardens"
"Residentie Alfa"
"Residentie Verdé"
Expected sequence of results
"Residentie Verdé" ---- expecting this to be on top
"Residentie Alfa"
"Residentie Golfgardens"
"VERD-INVEST"
"LEVERD ((LE-VERD))"
My index settings are as below
"analysis" : {
"filter" : {
"email_filter" : {
"type" : "pattern_capture",
"preserve_original" : "true",
"patterns" : [
"([^@]+)",
"(\\p{L}+)",
"(\\d+)",
"@(.+)"
]
},
"autocomplete_filter" : {
"type" : "edge_ngram",
"min_gram" : "3",
"max_gram" : "10"
}
},
"char_filter" : {
"digit_only" : {
"pattern" : "\\D+",
"type" : "pattern_replace",
"replacement" : ""
}
},
"normalizer" : {
"keyword_normalizer" : {
"filter" : [
"lowercase",
"asciifolding"
],
"type" : "custom",
"char_filter" : [ ]
}
},
"analyzer" : {
"number_analyzer" : {
"filter" : [
"trim"
],
"char_filter" : [
"digit_only"
],
"type" : "custom",
"tokenizer" : "digit_edge_ngram_tokenizer"
},
"email_analyzer" : {
"filter" : [
"email_filter",
"lowercase",
"unique"
],
"tokenizer" : "uax_url_email"
},
"search_number_analyzer" : {
"filter" : [
"trim"
],
"char_filter" : [
"digit_only"
],
"type" : "custom",
"tokenizer" : "keyword"
},
"autocomplete" : {
"filter" : [ ],
"type" : "custom",
"tokenizer" : "lowercase"
}
},
"tokenizer" : {
"digit_edge_ngram_tokenizer" : {
"token_chars" : [
"digit"
],
"min_gram" : "3",
"type" : "edgeNGram",
"max_gram" : "15"
}
}
}
My query is something like
{
"bool": {
"should": [
{
"fuzzy": {
"person.name.lastName": {
"value": "residentie verd",
"fuzziness": "AUTO",
"prefix_length": 0,
"max_expansions": 50,
"transpositions": false,
"boost": 21
}
}
},
{
"match": {
"person.name.lastName": {
"query": "residentie verd",
"operator": "or",
"prefix_length": 0,
"max_expansions": 50,
"fuzzy_transpositions": true,
"lenient": false,
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": true,
"boost": 21
}
}
},
{
"match": {
"person.name.lastName.keyword": {
"query": "residentie verd",
"operator": "or",
"prefix_length": 0,
"max_expansions": 50,
"fuzzy_transpositions": true,
"lenient": false,
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": true,
"boost": 252
}
}
}
],
"adjust_pure_negative": true,
"minimum_should_match": "1",
"boost": 1
}
}