# Fuzzy search on Name having multiple words in it

**URL:** <https://discuss.elastic.co/t/fuzzy-search-on-name-having-multiple-words-in-it/242777>\
**Category:** Elasticsearch\
**Created:** [July 27, 2020, 3:40pm UTC](https://discuss.elastic.co/t/fuzzy-search-on-name-having-multiple-words-in-it/242777 "2020-07-27T15:40:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![meena](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/meena/32/71304_2.png) [@meena](https://discuss.elastic.co/u/meena)\
**Post date:** [July 27, 2020, 3:40pm UTC](https://discuss.elastic.co/t/fuzzy-search-on-name-having-multiple-words-in-it/242777/1 "2020-07-27T15:40:54Z")

</div>

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

```auto
    "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

```

```auto
{
                    "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
                    }
                  }

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 24, 2020, 3:40pm UTC](https://discuss.elastic.co/t/fuzzy-search-on-name-having-multiple-words-in-it/242777/2 "2020-08-24T15:40:55Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
