# Elasticsearch dis\_max with PHP

**URL:** <https://discuss.elastic.co/t/elasticsearch-dis-max-with-php/317976>\
**Category:** Elasticsearch\
**Created:** [November 2, 2022, 11:01am UTC](https://discuss.elastic.co/t/elasticsearch-dis-max-with-php/317976 "2022-11-02T11:01:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Makaveli1O](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/makaveli1o/32/112821_2.png) [@Makaveli1O](https://discuss.elastic.co/u/Makaveli1O)\
**Post date:** [November 2, 2022, 11:01am UTC](https://discuss.elastic.co/t/elasticsearch-dis-max-with-php/317976/1 "2022-11-02T11:01:12Z")

</div>

My console query looks like this:

```auto
{
  "query": {
    "dis_max": {
      "tie_breaker": 0.7,
      "boost": 1.2,
      "queries": [
        {
          "multi_match": {
            "query": "this exact phrase",
            "type": "phrase",
            "boost": 3,
            "fields": [
              "title^8",
              "metadesc^7", "kws^7", 
              "content^6", "com^6", "prom^6"
            ]
          }
        },
        {
          "multi_match": {
            "query": "this exact phrase",
            "operator": "and",
            "boost": 2,
            "fields": [
              "title^8",
              "metadesc^7", "kws^7", 
              "content^6", "com^6", "prom^6"
            ]
          }
        },
        {
          "multi_match": {
            "query": "this exact phrase",
            "fields": [
              "title^8",
              "metadesc^7", "kws^7", 
              "content^6", "com^6", "prom^6"
            ]
          }
        }
      ]
    }
    
  }
}

```

I can't get `dis_max` with **multi\_match** query to work in **PHP**.

```auto
stdClass Object
(
    [query] => stdClass Object
         (
             [dis_max] => stdClass Object
                (
                     [boost] => 1.2
                     [tie_breaker] => 0.7
                     [queries] => Array
                         (
                             [0] => stdClass Object
                                 (
                                     [multi_match] => stdClass Object
                                         (
                                            [fields] => Array
                                                 (
                                                     [0] => title
                                                 )
 
                                             [query] => this exact phrase
                                             [analyzer] => asciifolding_text
                                         )
 
                                 )
 
                             [1] => stdClass Object
                                 (
                                     [multi_match] => stdClass Object
                                         (
                                             [fields] => Array
                                                (
                                                     [0] => metadesc
                                                     [1] => kws
                                                 )
 
                                             [query] => this exact phrase
                                             [analyzer] => asciifolding_text
                                         )
 
                                )

                            [2] => stdClass Object
                                (
                                    [multi_match] => stdClass Object
                                        (
                                            [query] => this exact phrase
                                            [analyzer] => asciifolding_text
                                            [fields] => Array
                                                (
                                                    [0] => content
                                                    [1] => com
                                                     [2] => prom
                                                 )
 
                                        )
 
                                )
 
                         )
 
                 )
 
         )
 
 )

```

This is as close as I got, but still no luck. Anybody who knows where is the problem? Thanks.

_Note: It is just first part of the query -- first multi\_match_

---

<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:** [November 30, 2022, 11:01am UTC](https://discuss.elastic.co/t/elasticsearch-dis-max-with-php/317976/2 "2022-11-30T11:01:30Z")

</div>

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