Java Query Builders Query is Too Verbose


(blasearch) #1

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!


(David Pilato) #2

You mean search template, right?

If so, could you share your fullcode ?


(system) #3

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