# FilterBuilder.toString() not working as documented

**URL:** <https://discuss.elastic.co/t/filterbuilder-tostring-not-working-as-documented/11530>\
**Category:** Elasticsearch\
**Created:** [April 10, 2013, 1:26pm UTC](https://discuss.elastic.co/t/filterbuilder-tostring-not-working-as-documented/11530 "2013-04-10T13:26:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hans1](https://avatars.discourse-cdn.com/v4/letter/h/e68b1a/32.png) [@Hans1](https://discuss.elastic.co/u/Hans1)\
**Post date:** [April 10, 2013, 1:26pm UTC](https://discuss.elastic.co/t/filterbuilder-tostring-not-working-as-documented/11530/1 "2013-04-10T13:26:15Z")

</div>

In the official ES docs you can read the following:

> Note that you can easily print (aka debug) JSON generated queries using  
> toString() method on FilterBuilder object.

However, this doesn't seem to be the case. In contrast to  
BaseQueryBuilder.java where toString() actually is overriden to output the  
JSON, BaseFilterBuilder.java or other classes along the FilterBuilder  
inheritance chain do not.

Can anyone confirm that or tell me what I'm doing wrong?  
Plus, why don't both Base(Query|Filter)Builder classes don't extend a  
common superclass? Generally seems to me like there is pretty much  
duplicated code going on there (this is more like a quick and dirty guess)?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:41am UTC](https://discuss.elastic.co/t/filterbuilder-tostring-not-working-as-documented/11530/2 "2017-07-06T02:41:47Z")

</div>

Closed on July 6, 2017, 2:41am UTC


