# Wildcard query not working as expected

**URL:** <https://discuss.elastic.co/t/wildcard-query-not-working-as-expected/84447>\
**Category:** Kibana\
**Created:** [May 3, 2017, 6:05pm UTC](https://discuss.elastic.co/t/wildcard-query-not-working-as-expected/84447 "2017-05-03T18:05:30Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![molusc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/molusc/32/17902_2.png) [@molusc](https://discuss.elastic.co/u/molusc)\
**Post date:** [May 4, 2017, 8:18am UTC](https://discuss.elastic.co/t/wildcard-query-not-working-as-expected/84447/4 "2017-05-04T08:18:13Z")

</div>

That's a really fantastic article, thanks! I now understand the issue and I've learned a lot more as well.

To summarise here for anyone else, these are the key points relating to this issue...

- You can't use wildcards inside a phrase (ie. inside quotes)
- Whenever you use wildcards, your query is converted to lowercase
- Searching not\_analyzed fields is always case-sensitive

Therefore if you search a **not\_analyzed field** and **use wildcards** , you MUST NOT include any capital letters in your query, and you MUST NOT wrap it in quotes.

If you need a space in the query, escape it with `\`

These searches DO work correctly:

`useragent.name:*hrom*`  
`useragent.name:?hrom*`  
`useragent.name:*hrome*`  
`useragent.name:?hrome*`  
`useragent.name:?hrome\ *`  
`useragent.name:*?obile*`

So the main takeaway is...

**If you're searching a not\_analyzed field and using wildcards, replace all capital letters in the query with question marks.**

---

_[View the full topic](https://discuss.elastic.co/t/wildcard-query-not-working-as-expected/84447)._
