# Wildcard query returns null when Uppercase Letters are used

**URL:** <https://discuss.elastic.co/t/wildcard-query-returns-null-when-uppercase-letters-are-used/24822>\
**Category:** Elasticsearch\
**Created:** [July 2, 2015, 7:22pm UTC](https://discuss.elastic.co/t/wildcard-query-returns-null-when-uppercase-letters-are-used/24822 "2015-07-02T19:22:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AkshataNaik](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@AkshataNaik](https://discuss.elastic.co/u/AkshataNaik)\
**Post date:** [July 2, 2015, 7:22pm UTC](https://discuss.elastic.co/t/wildcard-query-returns-null-when-uppercase-letters-are-used/24822/1 "2015-07-02T19:22:38Z")

</div>

Hi, I am developing a search site which calls elasticsearch internally. I am using wildcard query to match entered text. everything works well when lowercase letters are entered. But when Uppercase letters are entered the results come up only for the complete word and not for the partial letters.  
The word is queried in the below fashion.

```auto
var query=
			{
				"wildcard":{
					_all:"* "+term+"*"
					}
			};

```

I have not used any custom filters or analyzers for the index. I just create an index and insert strings into the types.

Please could someone tell me what is wrong with my approach. Or any alternate suggestions are also welcome.

Thanks

---

<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:** [July 2, 2015, 8:54pm UTC](https://discuss.elastic.co/t/wildcard-query-returns-null-when-uppercase-letters-are-used/24822/2 "2015-07-02T20:54:04Z")

</div>

Don't use wildcard queries. At least don't use them with a wildcard `*` at the beginning of your query. It will be extremely slow!

Wildcard queries are not analyzed. It means that we compare exactly the term with the inverted index.

For example, with default analyzer, `Foo BAR` will be indexed as `foo`, `bar`.  
If you search with a wildcard for `*BAR*`, `BAR` is not `bar`. So it won't match.

---

<div class="post-metadata">

**Author:** ![AkshataNaik](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@AkshataNaik](https://discuss.elastic.co/u/AkshataNaik)\
**Post date:** [July 7, 2015, 4:21pm UTC](https://discuss.elastic.co/t/wildcard-query-returns-null-when-uppercase-letters-are-used/24822/3 "2015-07-07T16:21:32Z")

</div>

Thank you David!

So what do you suggest me to use. I need search results on every string entered in the search bar. I tried using match, but it did not work as expected.

---

<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:** [July 7, 2015, 6:21pm UTC](https://discuss.elastic.co/t/wildcard-query-returns-null-when-uppercase-letters-are-used/24822/4 "2015-07-07T18:21:50Z")

</div>

Use another analyzer. Such as `ngram` or `edge ngram` based analyzers.

---

<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 6, 2017, 12:03am UTC](https://discuss.elastic.co/t/wildcard-query-returns-null-when-uppercase-letters-are-used/24822/5 "2017-07-06T00:03:05Z")

</div>


