Wildcard query not working as expected

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.