Do I need a match all before filters?

Hello guys,

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

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

Or I can just filter them directly ?

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

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 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.

1 Like

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.

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