# Do I need a match all before filters?

**URL:** <https://discuss.elastic.co/t/do-i-need-a-match-all-before-filters/128320>\
**Category:** Elasticsearch\
**Created:** [April 17, 2018, 8:57am UTC](https://discuss.elastic.co/t/do-i-need-a-match-all-before-filters/128320 "2018-04-17T08:57:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Islam\_Elshobokshy](https://avatars.discourse-cdn.com/v4/letter/i/77aa72/32.png) [@Islam\_Elshobokshy](https://discuss.elastic.co/u/Islam_Elshobokshy)\
**Post date:** [April 17, 2018, 8:57am UTC](https://discuss.elastic.co/t/do-i-need-a-match-all-before-filters/128320/1 "2018-04-17T08:57:53Z")

</div>

Hello guys,

If I want to filter results from an elasticsearch type, do I need to match all of them first like this :

```auto
      "query": {
        "bool": {
          "must": {
            "match_all": {}
          },
          "filter": {
            "term": {
              "status": "active"
            }
          }
        }
      }
    } 

```

Or I can just filter them directly ?

```auto
      "query": {
        "bool": {
          "filter": {
            "term": {
              "status": "active"
            }
          }
        }
      }
    }

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 17, 2018, 11:58am UTC](https://discuss.elastic.co/t/do-i-need-a-match-all-before-filters/128320/2 "2018-04-17T11:58:44Z")

</div>

No it's not needed. The later form is perfect.

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

There's a live preview panel for exactly this reasons.

---

<div class="post-metadata">

**Author:** ![Islam\_Elshobokshy](https://avatars.discourse-cdn.com/v4/letter/i/77aa72/32.png) [@Islam\_Elshobokshy](https://discuss.elastic.co/u/Islam_Elshobokshy)\
**Post date:** [April 17, 2018, 12:11pm UTC](https://discuss.elastic.co/t/do-i-need-a-match-all-before-filters/128320/3 "2018-04-17T12:11:42Z")

</div>

I clicked on the Preformatted Text button and that gave each line 4 spaces before each first letter but it didn't quite format anything. I didn't notice I had to put these quotes, my bad.

Thank you for the answer.

---

<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:** [May 15, 2018, 12:11pm UTC](https://discuss.elastic.co/t/do-i-need-a-match-all-before-filters/128320/4 "2018-05-15T12:11:55Z")

</div>

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