# Wildcard + phrase combination search case insensitive

**URL:** <https://discuss.elastic.co/t/wildcard-phrase-combination-search-case-insensitive/154463>\
**Category:** Elasticsearch\
**Created:** [October 29, 2018, 3:52pm UTC](https://discuss.elastic.co/t/wildcard-phrase-combination-search-case-insensitive/154463 "2018-10-29T15:52:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![viphuangwei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/viphuangwei/32/59306_2.png) [@viphuangwei](https://discuss.elastic.co/u/viphuangwei)\
**Post date:** [October 29, 2018, 3:52pm UTC](https://discuss.elastic.co/t/wildcard-phrase-combination-search-case-insensitive/154463/1 "2018-10-29T15:52:01Z")

</div>

Hi There,

I am using `_xpack/sql/` to do the searching. When there's only phrase searching it's case insensitive.  
But if i used wildcard + phrase combination search it's case sensitive Why? I want it both cases should be case insensitive.

e.g. If i use below sql to do searching, if only return 'super hero', not return 'SUPER HERO'

```auto
post _xpack/sql/
{
  "query": "select column_A from index_A where query( '*super\\\\ hero*', 'type=phrase;default_operator=AND')"
}

```

if i remove the wildcard as below. it would return both.

```auto
post _xpack/sql/
{
  "query": "select column_A from index_A where query( 'super\\\\ hero', 'type=phrase;default_operator=AND')"
}

```

* * *

Is there any solution to do wildcard + phrase combination search case insensitive, without using the analyzer?

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [October 30, 2018, 8:21am UTC](https://discuss.elastic.co/t/wildcard-phrase-combination-search-case-insensitive/154463/2 "2018-10-30T08:21:11Z")

</div>

Hi @viphuangwei,  
The `query` special function in SQL is a wrapper for a `query_string` query from Elasticsearch. If you try the `translate` API from SQL you will see the actual query that ES is using to return the results.

These being said, `query_string` and phrase matching with wildcard will not work, thus the results you see. See [here](https://discuss.elastic.co/t/wildcard-with-exact-phrase-search-using-query-string/102631/5) a suggestion from of the Lucene/ES developers about the type of query to use for such functionality. Unfortunately, ES SQL doesn't use that.

---

<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:** [November 27, 2018, 8:21am UTC](https://discuss.elastic.co/t/wildcard-phrase-combination-search-case-insensitive/154463/3 "2018-11-27T08:21:18Z")

</div>

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