# Search term: should match 100 %

**URL:** <https://discuss.elastic.co/t/search-term-should-match-100/366001>\
**Category:** Elasticsearch\
**Created:** [September 4, 2024, 7:33am UTC](https://discuss.elastic.co/t/search-term-should-match-100/366001 "2024-09-04T07:33:48Z")\
**Posts on this page:** 7\
**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:** [September 4, 2024, 7:33am UTC](https://discuss.elastic.co/t/search-term-should-match-100/366001/1 "2024-09-04T07:33:48Z")

</div>

**Search term:** italian marble flooring

Document 1

```auto
{
    "s_title": "italian marble flooring"
}

```

Document 2

```auto
{
    "s_title": "italian marble floor"
}

```

Document 3

```auto
{
    "s_title": "italian marble flooring in salem"
}

```

**query which i have used**

```auto
{
    "_source": [
        "s_title"
    ],
    "size": 10,
    "query": {
        "bool": {
            "should": [
                {
                    "match_phrase": {
                        "s_title": {
                            "query": "italian marble flooring",
                            "boost": 1
                        }
                    }
                }
            ],
            "minimum_should_match": "1"
        }
    }
}

```

the query is returning all 3 documents, but I need to fetch only document 1 & document 2

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [September 4, 2024, 9:43am UTC](https://discuss.elastic.co/t/search-term-should-match-100/366001/2 "2024-09-04T09:43:11Z")

</div>

Hi @Mohan_T,

Can you share the index mapping, especially the type of field `s_title`? Is it defined as `keyword` or `text` type?

---

<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:** [September 4, 2024, 10:21am UTC](https://discuss.elastic.co/t/search-term-should-match-100/366001/3 "2024-09-04T10:21:36Z")

</div>

```auto
"s_title": {
  "type": "text",
  "fields": {
      "keyword_custom": {
          "type": "text",
          "analyzer": "custom_analyzer_keyword"
      },
      "standard_custom": {
          "type": "text",
          "analyzer": "custom_analyzer_standard"
      },
      "keyword": {
          "type": "keyword"
      }
  }
}

```

_ **analyzer** _

```auto
"analyzer": {
    "custom_analyzer_keyword": { # Creating a new analyzer for synonym and stemmer
        "tokenizer": "keyword",
        "filter": ["lowercase", "synonym_filter", "bad_words_filter", "custom_stemmer_filter", "stemmer_filter"]
    },
    "custom_analyzer_standard": { # Creating a new analyzer for synonym and stemmer
        "tokenizer": "standard",
        "filter": ["lowercase", "synonym_filter", "bad_words_filter", "custom_stemmer_filter", "stemmer_filter"]
    }
}

```

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [September 4, 2024, 1:09pm UTC](https://discuss.elastic.co/t/search-term-should-match-100/366001/4 "2024-09-04T13:09:56Z")

</div>

Thanks for sharing. For an exact match I would use the keyword field rather than the text field. Can you adapt your query and see if that gives you the results you're looking for?

---

<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:** [September 5, 2024, 4:42am UTC](https://discuss.elastic.co/t/search-term-should-match-100/366001/5 "2024-09-05T04:42:28Z")

</div>

> [@carly.richmond](#):
>
> ou adapt your query and see if that gives you the results y

If am using keyword am getting the result, but the stemmer is not getting applying for the string. Ex: **italian marble flooring**

not giving the results of **italian marbles flooring**

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [September 5, 2024, 9:39am UTC](https://discuss.elastic.co/t/search-term-should-match-100/366001/6 "2024-09-05T09:39:47Z")

</div>

> [@Mohan\_T](#):
>
> not giving the results of **italian marbles flooring**

Yes, it wouldn't give that result. It would match exactly to the term _italian marble flooring_. That's because the keyword field is not analyzed, so it doesn't undergo stemming or the other analysis steps.

Can you explain what you expect to see for the query _italian marbles flooring_? I wonder if changing the type of field `keyword_custom` is what you're looking for since it's currently listed as a `text` type.

---

<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 11, 2024, 8:16am UTC](https://discuss.elastic.co/t/search-term-should-match-100/366001/7 "2024-11-11T08:16:58Z")

</div>

> [@carly.richmond](#):
>
> what you're looking for since it's currently listed as a `text` type.

**Search term is:** italian marble flooring

Document 1

```auto
{
    "s_title": "italian marble flooring"
}

```

Document 2

```auto
{
    "s_title": "italian marble floor"
}

```

Document 3

```auto
{
    "s_title": "italian marble flooring in salem"
}

```

it should return only document 1 & document 2 with undergo stemming as well. it should not return all 3 documents
