# Field query - doesnt seem to be a constructor signature supporting boolean fields?

**URL:** <https://discuss.elastic.co/t/field-query-doesnt-seem-to-be-a-constructor-signature-supporting-boolean-fields/3518>\
**Category:** Elasticsearch\
**Created:** [November 4, 2010, 3:43pm UTC](https://discuss.elastic.co/t/field-query-doesnt-seem-to-be-a-constructor-signature-supporting-boolean-fields/3518 "2010-11-04T15:43:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mooky](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@mooky](https://discuss.elastic.co/u/mooky)\
**Post date:** [November 4, 2010, 3:43pm UTC](https://discuss.elastic.co/t/field-query-doesnt-seem-to-be-a-constructor-signature-supporting-boolean-fields/3518/1 "2010-11-04T15:43:30Z")

</div>

Something I ran into today: FieldQuery (and FieldQueryBuilder) has various  
different constructor signatures for float, double, integer, long, string  
fields .... but not for boolean. (I cant find a javadoc online to refer to  
now).

Is this an omission - or am I missing a trick?

Cheers,  
-Nick

---

<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:** [November 4, 2010, 6:12pm UTC](https://discuss.elastic.co/t/field-query-doesnt-seem-to-be-a-constructor-signature-supporting-boolean-fields/3518/2 "2010-11-04T18:12:31Z")

</div>

It accepts an Object, which can be a boolean. I will add a method for  
boolean as well. Note that for this type of queries (exact numeric / boolean  
match) its better to use the term query, which does not go through parsing  
the query string). And yes, term query also does not have a specific boolean  
method overload, but it does have an Object, so you can safely pass a  
boolean value.

-shay.banon

On Thu, Nov 4, 2010 at 5:43 PM, Nick Minutello [nick.minutello@gmail.com](mailto:nick.minutello@gmail.com)wrote:

> Something I ran into today: FieldQuery (and FieldQueryBuilder) has various  
> different constructor signatures for float, double, integer, long, string  
> fields .... but not for boolean. (I cant find a javadoc online to refer to  
> now).
> 
> Is this an omission - or am I missing a trick?
> 
> Cheers,  
> -Nick

---

<div class="post-metadata">

**Author:** ![mooky](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@mooky](https://discuss.elastic.co/u/mooky)\
**Post date:** [November 5, 2010, 10:38pm UTC](https://discuss.elastic.co/t/field-query-doesnt-seem-to-be-a-constructor-signature-supporting-boolean-fields/3518/3 "2010-11-05T22:38:29Z")

</div>

Cool. Thanks.

On 4 November 2010 18:12, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> It accepts an Object, which can be a boolean. I will add a method for  
> boolean as well. Note that for this type of queries (exact numeric / boolean  
> match) its better to use the term query, which does not go through parsing  
> the query string). And yes, term query also does not have a specific boolean  
> method overload, but it does have an Object, so you can safely pass a  
> boolean value.
> 
> -shay.banon
> 
> On Thu, Nov 4, 2010 at 5:43 PM, Nick Minutello [nick.minutello@gmail.com](mailto:nick.minutello@gmail.com)wrote:
> 
> > Something I ran into today: FieldQuery (and FieldQueryBuilder) has various  
> > different constructor signatures for float, double, integer, long, string  
> > fields .... but not for boolean. (I cant find a javadoc online to refer to  
> > now).
> > 
> > Is this an omission - or am I missing a trick?
> > 
> > Cheers,  
> > -Nick

---

<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:** [November 5, 2010, 11:04pm UTC](https://discuss.elastic.co/t/field-query-doesnt-seem-to-be-a-constructor-signature-supporting-boolean-fields/3518/4 "2010-11-05T23:04:57Z")

</div>

Just saw that those are private constructors. Just pushed and exposed both  
the Object and boolean values for those in TermQueryBuilder,  
FieldQueryBuilders, and in QueryBuilders static factories.

On Sat, Nov 6, 2010 at 12:38 AM, Nick Minutello [nick.minutello@gmail.com](mailto:nick.minutello@gmail.com)wrote:

> Cool. Thanks.
> 
> On 4 November 2010 18:12, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > It accepts an Object, which can be a boolean. I will add a method for  
> > boolean as well. Note that for this type of queries (exact numeric / boolean  
> > match) its better to use the term query, which does not go through parsing  
> > the query string). And yes, term query also does not have a specific boolean  
> > method overload, but it does have an Object, so you can safely pass a  
> > boolean value.
> > 
> > -shay.banon
> > 
> > On Thu, Nov 4, 2010 at 5:43 PM, Nick Minutello [nick.minutello@gmail.com](mailto:nick.minutello@gmail.com)wrote:
> > 
> > > Something I ran into today: FieldQuery (and FieldQueryBuilder) has  
> > > various different constructor signatures for float, double, integer, long,  
> > > string fields .... but not for boolean. (I cant find a javadoc online to  
> > > refer to now).
> > > 
> > > Is this an omission - or am I missing a trick?
> > > 
> > > Cheers,  
> > > -Nick

---

<div class="post-metadata">

**Author:** ![mooky](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@mooky](https://discuss.elastic.co/u/mooky)\
**Post date:** [November 6, 2010, 2:40pm UTC](https://discuss.elastic.co/t/field-query-doesnt-seem-to-be-a-constructor-signature-supporting-boolean-fields/3518/5 "2010-11-06T14:40:48Z")

</div>

Excellent. Thanks.

On 5 November 2010 23:04, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> Just saw that those are private constructors. Just pushed and exposed both  
> the Object and boolean values for those in TermQueryBuilder,  
> FieldQueryBuilders, and in QueryBuilders static factories.
> 
> On Sat, Nov 6, 2010 at 12:38 AM, Nick Minutello [nick.minutello@gmail.com](mailto:nick.minutello@gmail.com)wrote:
> 
> > Cool. Thanks.
> > 
> > On 4 November 2010 18:12, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:
> > 
> > > It accepts an Object, which can be a boolean. I will add a method for  
> > > boolean as well. Note that for this type of queries (exact numeric / boolean  
> > > match) its better to use the term query, which does not go through parsing  
> > > the query string). And yes, term query also does not have a specific boolean  
> > > method overload, but it does have an Object, so you can safely pass a  
> > > boolean value.
> > > 
> > > -shay.banon
> > > 
> > > On Thu, Nov 4, 2010 at 5:43 PM, Nick Minutello \<[nick.minutello@gmail.com](mailto:nick.minutello@gmail.com)
> > > 
> > > > wrote:
> > > 
> > > > Something I ran into today: FieldQuery (and FieldQueryBuilder) has  
> > > > various different constructor signatures for float, double, integer, long,  
> > > > string fields .... but not for boolean. (I cant find a javadoc online to  
> > > > refer to now).
> > > > 
> > > > Is this an omission - or am I missing a trick?
> > > > 
> > > > Cheers,  
> > > > -Nick

---

<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:16am UTC](https://discuss.elastic.co/t/field-query-doesnt-seem-to-be-a-constructor-signature-supporting-boolean-fields/3518/6 "2017-07-06T04:16:59Z")

</div>

Closed on July 6, 2017, 4:16am UTC


