# Creating a no-op QueryBuilder and FilterBuilder

**URL:** <https://discuss.elastic.co/t/creating-a-no-op-querybuilder-and-filterbuilder/23114>\
**Category:** Elasticsearch\
**Created:** [April 6, 2015, 11:13pm UTC](https://discuss.elastic.co/t/creating-a-no-op-querybuilder-and-filterbuilder/23114 "2015-04-06T23:13:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Todd\_Nine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/todd_nine/32/778_2.png) [@Todd\_Nine](https://discuss.elastic.co/u/Todd_Nine)\
**Post date:** [April 6, 2015, 11:13pm UTC](https://discuss.elastic.co/t/creating-a-no-op-querybuilder-and-filterbuilder/23114/1 "2015-04-06T23:13:17Z")

</div>

Hey all,  
I have a bit of an odd question, hopefully someone can give me an answer.  
In usergrid, we have our own existing query language. We parse this  
language into an AST, then visit each of the nodes and construct an ES  
query with the java client. So far, very straight forward. However, we  
have 1 wrench in the works. Some of our operations can only be implemented  
as filters. As a result, visiting some of our nodes results in a  
QueryBuilder operation, others in a FilterBuilder operation. To keep our  
context so that we still evaluate AND, OR, and NOT correctly, I'm pushing  
BoolQueryBuilder and BoolFilterBuilder on to our stacks as we traverse the  
tree. Within these bool terms, I will have both query and filter  
operations that represent a "no-op" operation. Is there such a build that  
already exists in the client, or will I need to create my own that doesn't  
append any content during the build phase?

Thanks,  
Todd

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/634d71c1-c03e-476c-a293-f5114cfe35cf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/634d71c1-c03e-476c-a293-f5114cfe35cf%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![masaru](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@masaru](https://discuss.elastic.co/u/masaru)\
**Post date:** [April 7, 2015, 7:44am UTC](https://discuss.elastic.co/t/creating-a-no-op-querybuilder-and-filterbuilder/23114/2 "2015-04-07T07:44:53Z")

</div>

match all query(QueryBuilders.matchAllQuery()) and match all filter(FilterBuilders.matchAllFilter())?

On April 7, 2015 at 08:13:29, Todd Nine ([tnine@apigee.com](mailto:tnine@apigee.com)) wrote:

Hey all,  
I have a bit of an odd question, hopefully someone can give me an answer. In usergrid, we have our own existing query language. We parse this language into an AST, then visit each of the nodes and construct an ES query with the java client. So far, very straight forward. However, we have 1 wrench in the works. Some of our operations can only be implemented as filters. As a result, visiting some of our nodes results in a QueryBuilder operation, others in a FilterBuilder operation. To keep our context so that we still evaluate AND, OR, and NOT correctly, I'm pushing BoolQueryBuilder and BoolFilterBuilder on to our stacks as we traverse the tree. Within these bool terms, I will have both query and filter operations that represent a "no-op" operation. Is there such a build that already exists in the client, or will I need to create my own that doesn't append any content during the build phase?

## Thanks, Todd

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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/634d71c1-c03e-476c-a293-f5114cfe35cf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/634d71c1-c03e-476c-a293-f5114cfe35cf%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/etPan.55238b31.74b0dc51.124%40citra-2.local](https://groups.google.com/d/msgid/elasticsearch/etPan.55238b31.74b0dc51.124%40citra-2.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:21am UTC](https://discuss.elastic.co/t/creating-a-no-op-querybuilder-and-filterbuilder/23114/3 "2017-07-06T00:21:16Z")

</div>


