# Leading wildcard search handling

**URL:** <https://discuss.elastic.co/t/leading-wildcard-search-handling/81181>\
**Category:** Elasticsearch\
**Created:** [April 4, 2017, 4:46pm UTC](https://discuss.elastic.co/t/leading-wildcard-search-handling/81181 "2017-04-04T16:46:14Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [April 4, 2017, 5:01pm UTC](https://discuss.elastic.co/t/leading-wildcard-search-handling/81181/2 "2017-04-04T17:01:10Z")

</div>

> [@bkerrigan](#):
>
> We need to allow leading wildcard searches on our Elasticsearch installation and I'm looking for the best way to handle them.

What for? Can you explain the use case for it?

> Add a reversed field for all the fields we want the leading wildcard to work for and use an edge n-gram filter to run the query using the index.

Definitely, I'll go that way. Have a look at:

> [@Edge\_ngram anchoring to the back](https://discuss.elastic.co/t/edge-ngram-anchoring-to-the-back/80479/2):
>
> You can use a combination of: [https://www.elastic.co/guide/en/elasticsearch/reference/5.3/analysis-reverse-tokenfilter.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/analysis-reverse-tokenfilter.html)[https://www.elastic.co/guide/en/elasticsearch/reference/5.3/analysis-edgengram-tokenfilter.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/analysis-edgengram-tokenfilter.html) ["reverse", "edge", "reverse"] so it will produce: [kciuQ] [kc, kci, kciu, kciuQ] [ck, ick, uick, Quick] Thanks to @jpountz for the solution. slight_smile

---

_[View the full topic](https://discuss.elastic.co/t/leading-wildcard-search-handling/81181)._
