# Multi\_match:best\_fields with complex queries no dis\_max

**URL:** <https://discuss.elastic.co/t/multi-match-best-fields-with-complex-queries-no-dis-max/110121>\
**Category:** Elasticsearch\
**Created:** [December 4, 2017, 11:03am UTC](https://discuss.elastic.co/t/multi-match-best-fields-with-complex-queries-no-dis-max/110121 "2017-12-04T11:03:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jose\_Victor\_da\_Silva](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@Jose\_Victor\_da\_Silva](https://discuss.elastic.co/u/Jose_Victor_da_Silva)\
**Post date:** [December 4, 2017, 11:03am UTC](https://discuss.elastic.co/t/multi-match-best-fields-with-complex-queries-no-dis-max/110121/1 "2017-12-04T11:03:39Z")

</div>

Is there any way to use the multi\_match interface using these more complex matchs?

Obs: I believe that multi\_match: best\_fields works as if it were an alias pro dis\_max in this situation mentioned

I am trying to use multi\_match to execute some queries, but as I read in the documentation, I noticed that within the multi\_match context I can not make explicit the whole complex structure of each field, for example:

```
 {
     "multi_match": {
        "query": "quick brown fox",
         "fields": ["title", "body"],
         "type": "best_fields" # default
     }
}

```

This structure above represents a simple multi\_match where it was not parameterized anything besides the fields used in the match and the value of the query, if I were for example want to put zero\_terms\_query already could not because multi\_match does not support this parameter, having as a following way:

```
{
    "dis_max": {
        "queries": [
            { "match": { "title": {
                             "query" : "quick brown fox",
                             "zero_terms_query" : 'all'
                       }} 
            },
            { "match": { "body": "quick brown fox" }}
        ]
    }
}
```

---

<div class="post-metadata">

**Author:** ![Jose\_Victor\_da\_Silva](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@Jose\_Victor\_da\_Silva](https://discuss.elastic.co/u/Jose_Victor_da_Silva)\
**Post date:** [December 4, 2017, 1:47pm UTC](https://discuss.elastic.co/t/multi-match-best-fields-with-complex-queries-no-dis-max/110121/2 "2017-12-04T13:47:34Z")

</div>

I was able to do it by applying some parameters inside the own multi-match, as below:

```
      'must' => [
                    'multi_match' => [
                        'query' => '{{query}}',
                        'zero_terms_query' => 'all',
                        'operator' => 'and',
                        'fields' => []
                    ]
                ],
```

---

<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:** [January 1, 2018, 1:47pm UTC](https://discuss.elastic.co/t/multi-match-best-fields-with-complex-queries-no-dis-max/110121/3 "2018-01-01T13:47:51Z")

</div>

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