Escaping Special Characters in Wildcard Query

Hi Dawi

The elasticsearch documentation says that "The wildcard query maps to
lucene WildcardQuery".
Elasticsearch Platform — Find real-time answers at scale | Elastic

The Lucene documentation says that there is the following list of
special characters:

These special characters apply to the query_string/field query, not to
the wildcard query. The only special characters in the wildcard query
are * and ?

I have tried every form of escaping I can imagine but I was not able
to search for * and ? using a wildcard query.

I'm guessing that the field that you are trying to search against is
analyzed with the standard analyzer? In which case, most punctuation is
removed, so characters like * will not exist in your terms, and thus
won't be searchable

Depending on what your data is, it make make sense to set your field to
{ index: not_analyzed}

clint