# Elasticsearch Query match 100% with exact match

**URL:** <https://discuss.elastic.co/t/elasticsearch-query-match-100-with-exact-match/370361>\
**Category:** Elasticsearch\
**Created:** [November 12, 2024, 4:05am UTC](https://discuss.elastic.co/t/elasticsearch-query-match-100-with-exact-match/370361 "2024-11-12T04:05:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohan\_T](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@Mohan\_T](https://discuss.elastic.co/u/Mohan_T)\
**Post date:** [November 12, 2024, 4:05am UTC](https://discuss.elastic.co/t/elasticsearch-query-match-100-with-exact-match/370361/1 "2024-11-12T04:05:49Z")

</div>

**Search term:** wall clock

**Document 1**

```auto
{
    "title": "wall clock"
}

```

**Document 2**

```auto
{
    "title": "clock wall"
}

```

**Document 3**

```auto
{
    "title": "wall clock in bangalore"
}

```

**query which I have used**

```auto
{
    "_source": [
        "title"
    ],
    "size": 10,
    "query": {
        "bool": {
            "should": [
                {
                    "match_phrase": {
                        "title": {
                            "query": "wall clock",
                            "boost": 1
                        }
                    }
                }
            ],
            "minimum_should_match": "1"
        }
    }
}

```

**Expected result:**

Document 1 & Document 2

Guide me with the same.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 12, 2024, 6:35am UTC](https://discuss.elastic.co/t/elasticsearch-query-match-100-with-exact-match/370361/2 "2024-11-12T06:35:32Z")

</div>

You can change your field from `text` to `keyword` in the mapping and use a `term` query. It will do exact match.

---

<div class="post-metadata">

**Author:** ![Mohan\_T](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@Mohan\_T](https://discuss.elastic.co/u/Mohan_T)\
**Post date:** [November 12, 2024, 7:43am UTC](https://discuss.elastic.co/t/elasticsearch-query-match-100-with-exact-match/370361/3 "2024-11-12T07:43:38Z")

</div>

> [@Mohan\_T](#):
>
> **Expected result:**
> 
> Document 1 & Document 2
> 
> Guide me with the same.

If I use a keyword, it doesn't undergo stemming or any other analysis steps.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [November 12, 2024, 7:48am UTC](https://discuss.elastic.co/t/elasticsearch-query-match-100-with-exact-match/370361/5 "2024-11-12T07:48:19Z")

</div>

When you use a `match_phrase` query clause the order of the terms matter so your query will never match document 2. If you use a normal query string both terms must match, but that will bring back all 3 documents. I can not think of a way to return documents 1 and 2 but not 3 as it also contains the tokens you are searching for.
