# Boolean query with minimum\_should\_match and fuzzy search

**URL:** <https://discuss.elastic.co/t/boolean-query-with-minimum-should-match-and-fuzzy-search/173433>\
**Category:** Elasticsearch\
**Created:** [March 22, 2019, 7:04am UTC](https://discuss.elastic.co/t/boolean-query-with-minimum-should-match-and-fuzzy-search/173433 "2019-03-22T07:04:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wussup13](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wussup13](https://discuss.elastic.co/u/wussup13)\
**Post date:** [March 22, 2019, 7:04am UTC](https://discuss.elastic.co/t/boolean-query-with-minimum-should-match-and-fuzzy-search/173433/1 "2019-03-22T07:04:34Z")

</div>

Hello,  
I am using a boolean query with minimum\_should\_match and fuzzy\_search. Ex. query (302 -\> house number, Jarvis -\> street, Buffalo -\> city):

```
{
   "query":{
      "bool":{
         "must":[
            {
               "match":{
                  "full.folding":{
                     "query":"302 Jarvis Buffalo",
                     "operator":"OR",
                     "fuzziness":"2",
                     "prefix_length":1,
                     "max_expansions":50,
                     "minimum_should_match":"75%",
                     "fuzzy_transpositions":true,
                     "lenient":false,
                     "zero_terms_query":"NONE",
                     "auto_generate_synonyms_phrase_query":true,
                     "boost":1.0
                  }
               }
            }
         ],
         "should":[
            {
               "match":{
                  "full.folding":{
                     "query":"302 Jarvis Buffalo",
                     "operator":"AND",
                     "fuzziness":"2",
                     "prefix_length":1,
                     "max_expansions":50,
                     "minimum_should_match":"100%",
                     "fuzzy_transpositions":true,
                     "lenient":false,
                     "zero_terms_query":"NONE",
                     "auto_generate_synonyms_phrase_query":true,
                     "boost":2.5
                  }
               }
            }
         ],
         "adjust_pure_negative":true,
         "boost":1.0
      }
   }
}

```

1. For the query like "302 Jarvis Buffalo", it returns OK result (house number type)
2. For the query like "302sss Jarvis Buffalo", it returns OK result (street type)
3. For the query like "302sss Jarvissss Buffalo", it returns BAD result (nothing, but should return city Buffalo)

I understand that behavior because I have a 75% minimum\_should\_match and 1 of 3 it is a bad result. When I set minimum\_should\_match to 1, then OR operator working on each term separately and don't find "Jarvis Buffalo", but find "Jarvis" or "Buffalo".

My question is:  
How I can find a workaround with Elasticsearch to return Buffalo as a city type for the third point and still return good results for the first two points?

---

<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:** [April 19, 2019, 7:04am UTC](https://discuss.elastic.co/t/boolean-query-with-minimum-should-match-and-fuzzy-search/173433/2 "2019-04-19T07:04:38Z")

</div>

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