# WildcardQueryBuilder and FieldQueryBuilder

**URL:** <https://discuss.elastic.co/t/wildcardquerybuilder-and-fieldquerybuilder/3046>\
**Category:** Elasticsearch\
**Created:** [June 28, 2010, 2:19am UTC](https://discuss.elastic.co/t/wildcardquerybuilder-and-fieldquerybuilder/3046 "2010-06-28T02:19:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuel\_Doyle](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Samuel\_Doyle](https://discuss.elastic.co/u/Samuel_Doyle)\
**Post date:** [June 28, 2010, 2:19am UTC](https://discuss.elastic.co/t/wildcardquerybuilder-and-fieldquerybuilder/3046/1 "2010-06-28T02:19:44Z")

</div>

Out of curiosity why does FieldQueryBuilder allow leading wildcards while  
the WildcardQueryBuilder does not?

Thanks

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [June 28, 2010, 9:35am UTC](https://discuss.elastic.co/t/wildcardquerybuilder-and-fieldquerybuilder/3046/2 "2010-06-28T09:35:54Z")

</div>

Had a look at field query handling, and it was missing proper handling of  
`allow_leading_wildcards` parameter. So, field query was not allowing  
leading wildcards regardless of what you placed in the builder. Is that what  
you meant? wildcard query should allow for leading wildcards.

-shay.banon

On Mon, Jun 28, 2010 at 5:19 AM, Samuel Doyle [samueldoyle@gmail.com](mailto:samueldoyle@gmail.com) wrote:

> Out of curiosity why does FieldQueryBuilder allow leading wildcards while  
> the WildcardQueryBuilder does not?
> 
> Thanks

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [June 28, 2010, 9:36am UTC](https://discuss.elastic.co/t/wildcardquerybuilder-and-fieldquerybuilder/3046/3 "2010-06-28T09:36:14Z")

</div>

Here is the issue:

> <https://github.com/elastic/elasticsearch/issues/236>
>
> Since it doesn't take into account \`allow\_leading\_wildcard\` parameter, which def…aults to \`true\`, then its not allowed to place leading wildcards in queries.

On Mon, Jun 28, 2010 at 12:35 PM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> Had a look at field query handling, and it was missing proper handling of  
> `allow_leading_wildcards` parameter. So, field query was not allowing  
> leading wildcards regardless of what you placed in the builder. Is that what  
> you meant? wildcard query should allow for leading wildcards.
> 
> -shay.banon
> 
> On Mon, Jun 28, 2010 at 5:19 AM, Samuel Doyle [samueldoyle@gmail.com](mailto:samueldoyle@gmail.com)wrote:
> 
> > Out of curiosity why does FieldQueryBuilder allow leading wildcards while  
> > the WildcardQueryBuilder does not?
> > 
> > Thanks

---

<div class="post-metadata">

**Author:** ![Samuel\_Doyle](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Samuel\_Doyle](https://discuss.elastic.co/u/Samuel_Doyle)\
**Post date:** [June 28, 2010, 1:19pm UTC](https://discuss.elastic.co/t/wildcardquerybuilder-and-fieldquerybuilder/3046/4 "2010-06-28T13:19:59Z")

</div>

Yeah thanks

On Mon, Jun 28, 2010 at 2:36 AM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> Here is the issue:  
> [Query DSL: field query does not take into account `allow_leading_wildcards` · Issue #236 · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues/issue/236)
> 
> On Mon, Jun 28, 2010 at 12:35 PM, Shay Banon \<[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)
> 
> > wrote:
> 
> > Had a look at field query handling, and it was missing proper handling of  
> > `allow_leading_wildcards` parameter. So, field query was not allowing  
> > leading wildcards regardless of what you placed in the builder. Is that what  
> > you meant? wildcard query should allow for leading wildcards.
> > 
> > -shay.banon
> > 
> > On Mon, Jun 28, 2010 at 5:19 AM, Samuel Doyle [samueldoyle@gmail.com](mailto:samueldoyle@gmail.com)wrote:
> > 
> > > Out of curiosity why does FieldQueryBuilder allow leading wildcards while  
> > > the WildcardQueryBuilder does not?
> > > 
> > > Thanks

---

<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, 4:22am UTC](https://discuss.elastic.co/t/wildcardquerybuilder-and-fieldquerybuilder/3046/5 "2017-07-06T04:22:56Z")

</div>


