# Q: Search value with filter problem

**URL:** <https://discuss.elastic.co/t/q-search-value-with-filter-problem/353275>\
**Category:** Elastic Search\
**Tags:** docker, elastic-site-search\
**Created:** [February 14, 2024, 1:01pm UTC](https://discuss.elastic.co/t/q-search-value-with-filter-problem/353275 "2024-02-14T13:01:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alanko5](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alanko5/32/131735_2.png) [@Alanko5](https://discuss.elastic.co/u/Alanko5)\
**Post date:** [February 14, 2024, 1:01pm UTC](https://discuss.elastic.co/t/q-search-value-with-filter-problem/353275/1 "2024-02-14T13:01:49Z")

</div>

I use api to search in elastic.

I send query:

```auto
{
    "bool": {
        "should": [
            {
                "fuzzy": {
                    "titleLabel.startswith": {
                        "value": "aquam",
                        "fuzziness": "AUTO",
                        "max_expansions": 20,
                        "prefix_length": 0,
                        "transpositions": true,
                        "boost": 20
                    }
                }
            }
        ],
        "minimum_should_match": 1
    }
}

```

analyzer:

```auto
"startswith": {
                    "tokenizer": "keyword",
                    "filter": [
                        "lowercase",
                        "icu_folding",
                    ]
                }

```

My problem is that if I search for the word "aqua" it finds nothing. If I search for the word "aquam" it will find one result. But I know that there are more results stored in the db ("aquaman 1, auqman 2, ....").  
The question is, why does it find nothing in the first case and only one result in the second?  
Can you please advise me why it doesn't work as I want?

THX

---

<div class="post-metadata">

**Author:** ![Kathleen\_DeRusso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kathleen_derusso/32/132039_2.png) [@Kathleen\_DeRusso](https://discuss.elastic.co/u/Kathleen_DeRusso)\
**Post date:** [February 14, 2024, 1:37pm UTC](https://discuss.elastic.co/t/q-search-value-with-filter-problem/353275/2 "2024-02-14T13:37:34Z")

</div>

Hey there @Alanko5 it sounds like you might be more interested in the [prefix](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-prefix-query.html) query than the fuzzy query. Give that a try and see if it better meets your needs!

---

<div class="post-metadata">

**Author:** ![Alanko5](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alanko5/32/131735_2.png) [@Alanko5](https://discuss.elastic.co/u/Alanko5)\
**Post date:** [February 14, 2024, 3:10pm UTC](https://discuss.elastic.co/t/q-search-value-with-filter-problem/353275/3 "2024-02-14T15:10:42Z")

</div>

yes, it is the case that "prefix" works better, but "fuzziness" does not supported.

---

<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 13, 2024, 3:11pm UTC](https://discuss.elastic.co/t/q-search-value-with-filter-problem/353275/4 "2024-03-13T15:11:01Z")

</div>

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