# Java Query Builders Query is Too Verbose

**URL:** https://discuss.elastic.co/t/java-query-builders-query-is-too-verbose/122906
**Category:** Elasticsearch
**Created:** [March 7, 2018, 3:10pm UTC](https://discuss.elastic.co/t/java-query-builders-query-is-too-verbose/122906 "2018-03-07T15:10:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Jeffrey\_Blayney](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@Jeffrey\_Blayney](https://discuss.elastic.co/u/Jeffrey_Blayney)
#### Post date: [March 7, 2018, 3:10pm UTC](https://discuss.elastic.co/t/java-query-builders-query-is-too-verbose/122906/1 "2018-03-07T15:10:20Z")

</div>

Hello,

I'd like the boost values and other defaults defined in my templates to be used.

Unfortunately, the boost values and possibly others are not being utilized from the templates because the default queries that are built provide a lot of output. For example:

MatchQueryBuilder someMatchQuery = QueryBuilders.matchQuery("someField", "field contains hello");  
logger.log(someMatchQuery.toString());

```
                "match" : {
                  "someField" : {
                    "query" : "field contains hello",
                    "operator" : "OR",
                    "prefix_length" : 0,
                    "max_expansions" : 50,
                    "fuzzy_transpositions" : true,
                    "lenient" : false,
                    "zero_terms_query" : "NONE",
                    "boost" : 1.0
                  }
                }

```

Ideally, building queries in java should work like building queries in json, they only populate fields that I've explicitly set. Now I cannot set a boost in a template in ES, I have to change the code and re-deploy.

Any help, discussion or fixes would be appreciated!

Thanks!

---

<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: [March 7, 2018, 3:46pm UTC](https://discuss.elastic.co/t/java-query-builders-query-is-too-verbose/122906/2 "2018-03-07T15:46:00Z")

</div>

You mean search template, right?

If so, could you share your fullcode ?

---

<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: [April 4, 2018, 3:46pm UTC](https://discuss.elastic.co/t/java-query-builders-query-is-too-verbose/122906/3 "2018-04-04T15:46:07Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
