# MultiMatchQuery useDisMax

**URL:** <https://discuss.elastic.co/t/multimatchquery-usedismax/233172>\
**Category:** Elasticsearch\
**Created:** [May 18, 2020, 6:12pm UTC](https://discuss.elastic.co/t/multimatchquery-usedismax/233172 "2020-05-18T18:12:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave\_Maiman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dave_maiman/32/67826_2.png) [@Dave\_Maiman](https://discuss.elastic.co/u/Dave_Maiman)\
**Post date:** [May 18, 2020, 6:12pm UTC](https://discuss.elastic.co/t/multimatchquery-usedismax/233172/1 "2020-05-18T18:12:51Z")

</div>

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:

```auto
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:

```auto
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](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](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html) 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

---

<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:** [June 15, 2020, 6:12pm UTC](https://discuss.elastic.co/t/multimatchquery-usedismax/233172/2 "2020-06-15T18:12:55Z")

</div>

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