# Question about must query

**URL:** <https://discuss.elastic.co/t/question-about-must-query/327282>\
**Category:** Elastic Training\
**Created:** [March 8, 2023, 3:19pm UTC](https://discuss.elastic.co/t/question-about-must-query/327282 "2023-03-08T15:19:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomizius](https://avatars.discourse-cdn.com/v4/letter/t/f08c70/32.png) [@tomizius](https://discuss.elastic.co/u/tomizius)\
**Post date:** [March 8, 2023, 3:19pm UTC](https://discuss.elastic.co/t/question-about-must-query/327282/1 "2023-03-08T15:19:06Z")

</div>

Course: \< Elastic Certified Engineer Exam\>  
Version: \<8.1\>  
Question:  
What is the difference between following two queries?

1:

```plaintext
{
  "query": {
    "bool": {
      "must": [
        {
          "multi_match": {
            "query": "star",
            "fields": [
              "original_title^2",
              "overview",
              "tagline"
            ]
          },
          "range": {
            "vote_average": {
              "gt": 7
            }
          }
        }
      ]
    }
  }
} 

```

2:

```plaintext
{
  "query": {
    "bool": {
      "must": 
        {
          "multi_match": {
            "query": "star",
            "fields": [
              "original_title^2",
              "overview",
              "tagline"
            ]
          },
          "range": {
            "vote_average": {
              "gt": 7
            }
          }
        }
    }
  }
} 

```

Does I need the array brackets or not?

---

<div class="post-metadata">

**Author:** ![matthew.gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew.gregory/32/118157_2.png) [@matthew.gregory](https://discuss.elastic.co/u/matthew.gregory)\
**Post date:** [March 8, 2023, 3:42pm UTC](https://discuss.elastic.co/t/question-about-must-query/327282/2 "2023-03-08T15:42:55Z")

</div>

Hello,

You are just missing the after the must array, so: the first has must: , the second is missing the

---

<div class="post-metadata">

**Author:** ![Mark\_Laney](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_laney/32/44349_2.png) [@Mark\_Laney](https://discuss.elastic.co/u/Mark_Laney)\
**Post date:** [March 8, 2023, 4:06pm UTC](https://discuss.elastic.co/t/question-about-must-query/327282/3 "2023-03-08T16:06:57Z")

</div>

Yes, you need the array brackets. The "must" command is allowed to have one argument without using the array notation, i.e. square brackets, . However, if you want to use more than one argument you need square brackets. Here you do have more than one - multi\_match and range. Thus, #1 will work but #2 will not work.

---

<div class="post-metadata">

**Author:** ![jenyphurinaz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jenyphurinaz/32/76106_2.png) [@jenyphurinaz](https://discuss.elastic.co/u/jenyphurinaz)\
**Post date:** [March 8, 2023, 4:14pm UTC](https://discuss.elastic.co/t/question-about-must-query/327282/4 "2023-03-08T16:14:25Z")

</div>

The range must be within it's own 'clause' within the array so I don't believe either of those will work.

This works:

```auto
{
  "query": {
    "bool": {
      "must": [
        {
          "multi_match": {
            "query": "star",
            "fields": [
              "original_title^2",
              "overview",
              "tagline"
            ]
          }
        },
        {
          "range": {
            "vote_average": {
              "gt": 7
            }
          }
        }
      ]
    }
  }
}

```

---

<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:** [April 7, 2023, 4:15pm UTC](https://discuss.elastic.co/t/question-about-must-query/327282/5 "2023-04-07T16:15:12Z")

</div>

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