# Java - build query due to the many fields

**URL:** <https://discuss.elastic.co/t/java-build-query-due-to-the-many-fields/116493>\
**Category:** Elasticsearch\
**Created:** [January 22, 2018, 2:19pm UTC](https://discuss.elastic.co/t/java-build-query-due-to-the-many-fields/116493 "2018-01-22T14:19:19Z")\
**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:** [January 22, 2018, 2:52pm UTC](https://discuss.elastic.co/t/java-build-query-due-to-the-many-fields/116493/2 "2018-01-22T14:52:16Z")

</div>

To format your code, please use the code button, not the citation button.

Basically you want to run a [Bool Query](https://www.elastic.co/guide/en/elasticsearch/reference/6.1/query-dsl-bool-query.html), right?

Have a look at: [https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.1/java-rest-high-query-builders.html#\_compound\_queries](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.1/java-rest-high-query-builders.html#_compound_queries)

I just wrote an example here: [Elastic search depreciated classes](https://discuss.elastic.co/t/elastic-search-depreciated-classes/116232/8?u=dadoonet)

---

_[View the full topic](https://discuss.elastic.co/t/java-build-query-due-to-the-many-fields/116493)._
