Java - build query due to the many fields

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

Basically you want to run a Bool Query, 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

I just wrote an example here: Elastic search depreciated classes