MultiMatchQuery useDisMax

Hello,

We are in the process of upgrading to elastic cloud 7.x from 1.6. We have code that creates a MultiMatchQuery as follows:

QueryBuilders.multiMatchQuery(searchQuery, ElasticQueryCreator.SEARCH_FIELDS)
            .type(MultiMatchQueryBuilder.Type.PHRASE_PREFIX)
            .slop(SLOP)
            .lenient(true)
            .maxExpansions(MAX_EXPANSIONS)
            .cutoffFrequency(CUTOFF_FREQUENCY)
            .useDisMax(true);

As of 6.x the useDisMax api has been deprecated and removed entirely in 7.x. What would be the best way to do this now? I found some documentation indicating that we should leverage tieBreaker() instead and set the tieBreaker to 1.0f. Another indicates using the new DisMaxQueryBuilder instead and adding the MultiMatchQuery to it such as:

QueryBuilders.disMaxQuery()
        .add(QueryBuilders.multiMatchQuery(searchQuery, ElasticQueryCreator.SEARCH_FIELDS)
            .type(MultiMatchQueryBuilder.Type.PHRASE_PREFIX)
            .slop(ElasticQueryCreator.SLOP_SIZE)
            .lenient(true)
            .maxExpansions(ElasticQueryCreator.PHRASE_PREFIX_QUERY_MAX_EXPANSIONS)
            .cutoffFrequency(ElasticQueryCreator.CUTOFF_FREQUENCY));

What would be the best way to achieve this?

Additionally, cutoffFrequency seems to be deprecated with no replacement. Documentation in 7.7 states:

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#query-dsl-match-query-cutoff

"This option can be omitted as the Match can skip blocks of documents efficiently, without any configuration, provided that the total number of hits is not tracked."

I was going to just remove the call - until I read the last part indicating "provided that the total number of hits is not tracked". What exactly does this mean?

-Dave

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