# "match-boolean-query doesn't return the "exact match word" of the query

**URL:** <https://discuss.elastic.co/t/match-boolean-query-doesnt-return-the-exact-match-word-of-the-query/315918>\
**Category:** Elasticsearch\
**Created:** [October 5, 2022, 11:54pm UTC](https://discuss.elastic.co/t/match-boolean-query-doesnt-return-the-exact-match-word-of-the-query/315918 "2022-10-05T23:54:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paris1](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@paris1](https://discuss.elastic.co/u/paris1)\
**Post date:** [October 5, 2022, 11:54pm UTC](https://discuss.elastic.co/t/match-boolean-query-doesnt-return-the-exact-match-word-of-the-query/315918/1 "2022-10-05T23:54:18Z")

</div>

I'm using "match-Boolean-prefix query but I can't get the exact match of the query.I can't use prefix queries because I also need "not exact match" results and I also need the fuzziness and word completion.I get every thing I need by match-boo-prefix query(the fuzziness not work that good though) but my problem is when I'm looking for exact match like "apple" it shows everything that includes "apple" I need the exact match gets higher ranking than others.

```auto
GET /_search
{
    "query": {
        "bool": {
            "must": [
                {
                    "match_bool_prefix": {
                        "name": {
                            "query": "milk",
                            "fuzziness": "auto"
                        }
                    }
                },
                {
                    "bool": {
                        "must_not": [
                            {
                                "match": {
                                    "type": "3"
                                }
                            },
                            {
                                "match": {
                                    "type": "4"
                                }
                            }
                        ]
                    }
                },
                {
                    "match": {
                        "status": "A"
                    }
                }
            ],
            "should": [
                {
                    "exists": {
                        "field": "",
                        "boost": 10
                    }
                }
            ]
        }
    },
    "indices_boost": [
        {
            "index1": 3
        },
        {
            "index2": 1.3
        },
        {
            "index3": 1.5
        }
    ],
    "size": 20
}

```

the result I'm getting with this query is :

```auto
"_score": 88.10016,
                "_source": {
                    "status": "A",
                    "name": "Milkhsake, Chocolate",
_score": 86.66473,
                "_source": {
                    "status": "A",
                    "name": "Milky Milk",
score": 86.64781,
                "_source": {
                    "status": "A",
                    "name": "Milkis",
........

```

The exact result of "milk" goes down the list.

Is there any suggestion how can I fix this 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:** [November 2, 2022, 11:54pm UTC](https://discuss.elastic.co/t/match-boolean-query-doesnt-return-the-exact-match-word-of-the-query/315918/2 "2022-11-02T23:54:47Z")

</div>

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