Elasticsearch 8.5 Java Client increase field weights during search

Hi! I'm trying to figure out how to boost weights for some of the fields in the index during a search. For instance, I have the name field and I'd like Elasticsearch to give it x2 relevance score. Is it possible to do this with the client? When I used version 7 I had a method

    /** Add several fields to run the query against with a specific boost. */
    public SimpleQueryStringBuilder fields(Map<String, Float> fields) {
        Objects.requireNonNull(fields, "fields cannot be null");
        for (float fieldBoost : fields.values()) {
        return this;

What is the alternative?

I've found one approach to concatenate ^ sign with a weight to needed fields. For example, "fields": ["name^2"] not sure it works though. Will try.

Yes, it works! Though it is not a solution using the client and I'm still wondering if there is one

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