Unable to find in Java Client API ES 8.7 replacement of fieldsAndWeights in QueryStringQueryBuilder of earlier version

Before ES 8 we were using below query.

 final BoolQueryBuilder expectedBooleanQuery = QueryBuilders.boolQuery();
                   "title", 15f,
                   "title-alt", 5f)) 
           .field("some-title", 1f)

New Java API for 8.x I could not field fields with weight setting in API as MAP

    final BoolQuery.Builder expectedBooleanQuery = new BoolQuery.Builder().must(
            new Query.Builder().queryString(queryStringQuery -> queryStringQuery.query("water")

In the new API we can see only .fields(ImmutableList.of("all")) allows List of string but how to set same as earlier version like.
"title", 15f,
"title-alt", 5f))

Please advice . much appreciated any help.

Seems no one responding , i noticed similar request.

That also no one responded. So can we not able to get any suggestion from any elastic team experts ? No detailed migration guide for every case i agree but any one share the experience helps a lot.

It has been less than a day since your initial post and it is a weekend. This forum is manned by volunteers, so it can often take a few days to get an answer. If your question is very specific or around an area limited number of people have experience with it may take longer and it is possible you will not get an answer at all.

If you have not received any response after 2-3 days (excluding weekends) you can up the thread, but remember that there are no SLAs here.


Hi @ramyogi.

Have you tried the same approach where there is field and weight concatenation?

If that is the only option through new Java API es client will proceed the implementation but wanted to make sure that. Thanks a lot

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