# Query\_string with fuzzy and stammer filter works wierd

**URL:** https://discuss.elastic.co/t/query-string-with-fuzzy-and-stammer-filter-works-wierd/268956
**Category:** Elasticsearch
**Created:** [March 31, 2021, 7:58pm UTC](https://discuss.elastic.co/t/query-string-with-fuzzy-and-stammer-filter-works-wierd/268956 "2021-03-31T19:58:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![fedoroko](https://avatars.discourse-cdn.com/v4/letter/f/977dab/32.png) [@fedoroko](https://discuss.elastic.co/u/fedoroko)
#### Post date: [March 31, 2021, 7:58pm UTC](https://discuss.elastic.co/t/query-string-with-fuzzy-and-stammer-filter-works-wierd/268956/1 "2021-03-31T19:58:31Z")

</div>

Found some strange thing with query\_string and stemmer/snowball filters, can't understand how does it work and how to fix this, help me, please.

**Analyzer and filter** :

```auto
    'analyzer' => [
                                'stem_en' => [
                                    'tokenizer' => 'standard',
                                    'filter' => [
                                        'stem_en'
                                    ]
                                ],
                                'snow_en' => [
                                    'tokenizer' => 'standard',
                                    'filter' => [
                                        'snow_en'
                                    ]
                                ],
      ],
    'filter' => [
                                'stem_en' => [
                                    'type' => 'stemmer',
                                    'language' => 'english'
                                ],
                                'snow_en' => [
                                    'type' => 'snowball',
                                    'language' => 'english'
                                ],
    ]

```

**Field mapping** :

```auto
    'example' => [
                                'type' => 'text',
                                'fields' => [
                                    'snow' => [
                                        'type' => 'text',
                                        'analyzer' => 'snow_en'
                                    ],
                                    'stem' => [
                                        'type' => 'text',
                                        'analyzer' => 'stem_en'
                                    ],
                                ],
    ]

```

**Query 1** :

```auto
    {

      "explain": true,

      "query": {

        "query_string": {

          "fields": ["example.snow", "example.stem],

          "query": "walking~"

        }

      }

    }

```

**Result 1** :

```auto
    {

        "took": 11,

        "timed_out": false,

        "_shards": {

            "total": 1,

            "successful": 1,

            "skipped": 0,

            "failed": 0

        },

        "hits": {

            "total": {

                "value": 0,

                "relation": "eq"

            },

            "max_score": null,

            "hits": []

        }

    }

```

**Query 2** :

```auto
    {

      "explain": true,

      "query": {

        "query_string": {

          "fields": ["example.snow", "example.stem],

          "query": "walkin~"

        }

      }

    }

```

**Result 2** :

```auto
    {

        "took": 3,

        "timed_out": false,

        "_shards": {

            "total": 1,

            "successful": 1,

            "skipped": 0,

            "failed": 0

        },

        "hits": {

            "total": {

                "value": 1,

                "relation": "eq"

            },

            "max_score": 1.5075798,

            "hits": [

                {
                     ...,
                     "_explanation": {
                        "value": 1.5075798,
                        "description": "max of:",
                        "details": [
                            {
                                "value": 1.5075798,
                                "description": "weight(example.snow:walk in 0) [PerFieldSimilarity], result of:",
                                "details": [ ...
    }

```

Why does query parser can't produce correct token "walk" from "walking~" but could do it with "walkin~"?

---

<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: [April 28, 2021, 7:58pm UTC](https://discuss.elastic.co/t/query-string-with-fuzzy-and-stammer-filter-works-wierd/268956/2 "2021-04-28T19:58:38Z")

</div>

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