# Wrong results appearing in elasticsearch must match query

**URL:** <https://discuss.elastic.co/t/wrong-results-appearing-in-elasticsearch-must-match-query/167275>\
**Category:** Elasticsearch\
**Created:** [February 6, 2019, 11:22am UTC](https://discuss.elastic.co/t/wrong-results-appearing-in-elasticsearch-must-match-query/167275 "2019-02-06T11:22:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marium\_Testlio](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Marium\_Testlio](https://discuss.elastic.co/u/Marium_Testlio)\
**Post date:** [February 6, 2019, 11:22am UTC](https://discuss.elastic.co/t/wrong-results-appearing-in-elasticsearch-must-match-query/167275/1 "2019-02-06T11:22:50Z")

</div>

I have the following Analyzer on the search field:

```
GET _analyze
{
  "tokenizer": "standard",
  "filter": [ "word_delimiter","lowercase", {"type" : "shingle",
                            "min_shingle_size" : 2,
                            "max_shingle_size" : 4,
                            "output_unigrams" : true}, {"type" : "pattern_replace",
                            "pattern" : " ",
                            "replacement" : ""} ],
  "text": "One marium malik 270"
}

```

Elastic search query:

```
{
  ["index"]=>
  string(19) "_dev"
  ["from"]=>
  int(0)
  ["size"]=>
  int(60)
  ["body"]=>
  array(3) {
    ["query"]=>
    array(1) {
      ["bool"]=>
      array(3) {
        ["should"]=>
        array(2) {
          [0]=>
          array(1) {
            ["bool"]=>
            array(1) {
              ["must"]=>
              array(3) {
                [0]=>
                array(1) {
                  ["match"]=>
                  array(1) {
                    ["searched_text"]=>
                    array(2) {
                      ["query"]=>
                      string(4) "marium"
                      ["fuzziness"]=>
                      string(4) "AUTO"
                    }
                  }
                }
                [1]=>
                array(1) {
                  ["match"]=>
                  array(1) {
                    ["searched_text"]=>
                    array(1) {
                      ["query"]=>
                      string(3) "malik270"
                    }
                  }
                }
                
              }
            }
          }
          [1]=>
          array(1) {
            ["bool"]=>
            array(1) {
              ["should"]=>
              array(1) {
                [0]=>
                array(1) {
                  ["match"]=>
                  array(1) {
                    ["manu_no"]=>
                    array(2) {
                      ["query"]=>
                      string(14) "marium malik270"
                      ["boost"]=>
                      int(10)
                    }
                  }
                }
              }
            }
          }
        }
        ["minimum_should_match"]=>
        int(1)
      }
    }    
    ["sort"]=>
    array(1) {
      ["sp"]=>
      array(2) {
        ["mode"]=>
        string(3) "min"
        ["order"]=>
        string(4) "desc"
      }
    }
  }
}

```

When I am searching for the above keywords, I am getting several irrelevant results.

Irrelevant results include:

```
marium malik 97
marium malik Plus TN
marium malik PLUS OG

```

etc.

But, if I remove 'malik', separate it in another must query:

```
must: match searched_keyword: 'malik'
must: match searched_keyword: '270'

```

and leave number alone in that query, then it works perfectly fine.

What could be the issue?

---

<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:** [March 6, 2019, 11:23am UTC](https://discuss.elastic.co/t/wrong-results-appearing-in-elasticsearch-must-match-query/167275/2 "2019-03-06T11:23:10Z")

</div>

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