# Elasticsearch Query: search result not same when am searching for wooden door and wooden doors

**URL:** <https://discuss.elastic.co/t/elasticsearch-query-search-result-not-same-when-am-searching-for-wooden-door-and-wooden-doors/353504>\
**Category:** Elasticsearch\
**Created:** [February 17, 2024, 12:09pm UTC](https://discuss.elastic.co/t/elasticsearch-query-search-result-not-same-when-am-searching-for-wooden-door-and-wooden-doors/353504 "2024-02-17T12:09:03Z")\
**Posts on this page:** 3\
**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:** [February 17, 2024, 12:09pm UTC](https://discuss.elastic.co/t/elasticsearch-query-search-result-not-same-when-am-searching-for-wooden-door-and-wooden-doors/353504/1 "2024-02-17T12:09:03Z")

</div>

when am search for **wooden door** and **wooden doors** results not show the same.

Query which i have used to fetch the data

```auto
{
    "query": {
        "bool": {
            "should": [
                {
                    "match": {
                        "keywords.keyword_values": {
                            "query": "wooden door",
                            "operator": "and",
                            "prefix_length": 0,
                            "max_expansions": 50,
                            "fuzzy_transpositions": "true",
                            "lenient": "false",
                            "zero_terms_query": "NONE",
                            "auto_generate_synonyms_phrase_query": "true",
                            "boost": 7.0
                        }
                    }
                }
            ],
            "adjust_pure_negative": true,
            "minimum_should_match": "1",
            "boost": 1.0
        }
    }
}

```

Document settings and mappings below:

```auto
mappings = {
    "properties": {
        "keywords": {
            "type": "object",
            "enabled": True,
            "properties": {
                "name": {
                    "type": "text",
                    "analyzer": "synonym_stemmer_bad_words_analyzer"
                }
            }
        }
    }
settings = {
        "analysis": {
            "analyzer": {
                "synonym_stemmer_bad_words_analyzer": {
                    "tokenizer": "standard",
                    "filter": [
                        "lowercase",
                        "synonym_filter",
                        "bad_words_filter",
                        "stemmer_filter"
                    ]
                }
            },
            "filter": {
                "bad_words_filter": {
                    "type": "stop",
                    "stopwords_path": "bannedwords.txt"
                },
                "synonym_filter": {
                    "type": "synonym",
                    "synonyms_path": "synonyms.txt"
                },
                "stemmer_filter": {
                    "type": "stemmer",
                    "name": "english"
                }
            }
        }
    }

```

Document which is stored format:

```auto
**Doc 1**

"keywords": [
    {
        "keyword_values": "wooden doors"
    }
]

**Doc 2**

"keywords": [
    {
        "keyword_values": "wooden door"
    }
]

```

in \_analyze when searching for a **wooden door** below is the result

```auto
{
    "tokens": [
        {
            "token": "wooden",
            "start_offset": 0,
            "end_offset": 6,
            "type": "<ALPHANUM>",
            "position": 0
        },
        {
            "token": "door",
            "start_offset": 7,
            "end_offset": 11,
            "type": "<ALPHANUM>",
            "position": 1
        }
    ]
}

```

But am not getting the wooden doors data in the search query

---

<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:** [February 17, 2024, 12:15pm UTC](https://discuss.elastic.co/t/elasticsearch-query-search-result-not-same-when-am-searching-for-wooden-door-and-wooden-doors/353504/2 "2024-02-17T12:15:25Z")

</div>

> [@Mohan\_T](#):
>
> ```auto
> "match": {
> "keywords.keyword_values": {
> 
> ```

It looks like you are queryinga. field for which you have not provided the mapping. When you minimize an example, please make sure you include all the relevant pieces of information.

> [@Mohan\_T](#):
>
> ```auto
> "keywords": {
> "type": "object",
> "enabled": True,
> "properties": {
> "name": {
> "type": "text",
> "analyzer": "synonym_stemmer_bad_words_analyzer"
> 
> ```

It looks like the `keywords.name` field has the analyzer and stemmer you are looking to use, but that field is not the one you are querying.

---

<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 16, 2024, 12:16pm UTC](https://discuss.elastic.co/t/elasticsearch-query-search-result-not-same-when-am-searching-for-wooden-door-and-wooden-doors/353504/3 "2024-03-16T12:16:06Z")

</div>

Closed on March 16, 2024, 12:16pm UTC

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