# Query\_string is case sensitive

**URL:** <https://discuss.elastic.co/t/query-string-is-case-sensitive/138054>\
**Category:** Elasticsearch\
**Created:** [June 30, 2018, 8:05am UTC](https://discuss.elastic.co/t/query-string-is-case-sensitive/138054 "2018-06-30T08:05:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skrudox](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Skrudox](https://discuss.elastic.co/u/Skrudox)\
**Post date:** [June 30, 2018, 8:05am UTC](https://discuss.elastic.co/t/query-string-is-case-sensitive/138054/1 "2018-06-30T08:05:57Z")

</div>

```
{
   "query":{
      "bool":{
         "must":[
            {
               "query_string":{
                  "query":"*sony*",
                  "analyze_wildcard":true,
                  "default_field":"title"
               }
            }
         ]
      }
   }
}

```

should this query above be case-insensitive? but in fact it is case-sensitive, is there any parameter I should add to make it case-insensitive?

---

<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:** [June 30, 2018, 9:16am UTC](https://discuss.elastic.co/t/query-string-is-case-sensitive/138054/2 "2018-06-30T09:16:11Z")

</div>

I'd not use anything like a wildcard query. See [Wildcard query | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html)

> Note that this query can be slow, as it needs to iterate over many terms. In order to prevent extremely slow wildcard queries, a wildcard term should not start with one of the wildcards \* or ?.

Coming back to your question, [documentation says](https://www.elastic.co/guide/en/elasticsearch/reference/6.3/query-dsl-query-string-query.html) about `analyze_wildcard`:

> By default, wildcards terms in a query string are not analyzed. By setting this value to true, a best effort will be made to analyze those as well.

---

<div class="post-metadata">

**Author:** ![Skrudox](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Skrudox](https://discuss.elastic.co/u/Skrudox)\
**Post date:** [June 30, 2018, 9:17am UTC](https://discuss.elastic.co/t/query-string-is-case-sensitive/138054/3 "2018-06-30T09:17:14Z")

</div>

that best effort - means that it will search for entries with upper and lower case?

---

<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:** [June 30, 2018, 9:18am UTC](https://discuss.elastic.co/t/query-string-is-case-sensitive/138054/4 "2018-06-30T09:18:39Z")

</div>

Depends on the analyzer you have for the fields I guess. What did you try so far and what does it give as a result?

---

<div class="post-metadata">

**Author:** ![Skrudox](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Skrudox](https://discuss.elastic.co/u/Skrudox)\
**Post date:** [June 30, 2018, 9:19am UTC](https://discuss.elastic.co/t/query-string-is-case-sensitive/138054/5 "2018-06-30T09:19:37Z")

</div>

I am trying to make it from the query side, not touching the inside backend-server settings cause they are mixed with django-haystack and I'am not sure on how it really works on the internal, and I didnt found anything about case-sensivity on the documentation, thats why I'am asking it here, does it even possible to make it case-insensitive at this way using only this query?

---

<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:** [June 30, 2018, 9:32am UTC](https://discuss.elastic.co/t/query-string-is-case-sensitive/138054/6 "2018-06-30T09:32:18Z")

</div>

I did not try myself as never ever I'm using wildcard queries. What did you try so far and what is the result?

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem.

---

<div class="post-metadata">

**Author:** ![Skrudox](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Skrudox](https://discuss.elastic.co/u/Skrudox)\
**Post date:** [June 30, 2018, 9:34am UTC](https://discuss.elastic.co/t/query-string-is-case-sensitive/138054/7 "2018-06-30T09:34:11Z")

</div>

the query above it is what I've tried, and my only question is how to force it search case-insensitive from the query side, thats all I ask, the only result is that does not return entries that are with different case, what isn't clear in my question?

---

<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:** [June 30, 2018, 10:05am UTC](https://discuss.elastic.co/t/query-string-is-case-sensitive/138054/8 "2018-06-30T10:05:57Z")

</div>

Nothing is unclear. I totally understand the question. I don't have the answer and to get an answer I need to reproduce the problem.  
To do that I need a script I can paste in Kibana to play around with your use case.

Again, I don't recommend doing the way you are doing it.

---

<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:** [July 28, 2018, 10:06am UTC](https://discuss.elastic.co/t/query-string-is-case-sensitive/138054/9 "2018-07-28T10:06:01Z")

</div>

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