# Filter context without bool

**URL:** https://discuss.elastic.co/t/filter-context-without-bool/264218
**Category:** Elasticsearch
**Created:** [February 13, 2021, 1:13pm UTC](https://discuss.elastic.co/t/filter-context-without-bool/264218 "2021-02-13T13:13:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![AndreKR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrekr/32/6233_2.png) [@AndreKR](https://discuss.elastic.co/u/AndreKR)
#### Post date: [February 13, 2021, 1:13pm UTC](https://discuss.elastic.co/t/filter-context-without-bool/264218/1 "2021-02-13T13:13:29Z")

</div>

It seems that the minimum code I need for a filter context match is:

```json
{
  "query": {
    "bool": {
      "filter": {
        ...
      }
    }
  }
}

```

That looks quite verbose and involves a `bool` query, even though no actual boolean combination happens at all.

Is there really no other way to start a filter context than the `bool` query?

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [February 13, 2021, 6:43pm UTC](https://discuss.elastic.co/t/filter-context-without-bool/264218/2 "2021-02-13T18:43:23Z")

</div>

Hi @AndreKR

Nope that is the way to do it AFAIK.

Little more explanation [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html) .

In short that `bool` is "anding" it with the query context... if you do not have not an explicit query context it is basically a `match_all` query "anded" with the filter so it is in fact executing the `bool`.

---

<div class="post-metadata">

### Author: ![AndreKR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrekr/32/6233_2.png) [@AndreKR](https://discuss.elastic.co/u/AndreKR)
#### Post date: [February 13, 2021, 7:03pm UTC](https://discuss.elastic.co/t/filter-context-without-bool/264218/3 "2021-02-13T19:03:53Z")

</div>

> [@stephenb](#):
>
> if you do not have not an explicit query context it is basically a `match_all` query "anded" with the filter

I guess that's a good way to remember it. 🤷‍♂️

---

<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: [March 13, 2021, 7:04pm UTC](https://discuss.elastic.co/t/filter-context-without-bool/264218/4 "2021-03-13T19:04:17Z")

</div>

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