# Prevail must\_not over filter condition

**URL:** <https://discuss.elastic.co/t/prevail-must-not-over-filter-condition/234537>\
**Category:** Elasticsearch\
**Created:** [May 27, 2020, 12:15pm UTC](https://discuss.elastic.co/t/prevail-must-not-over-filter-condition/234537 "2020-05-27T12:15:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clony](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/clony/32/44738_2.png) [@Clony](https://discuss.elastic.co/u/Clony)\
**Post date:** [May 27, 2020, 12:15pm UTC](https://discuss.elastic.co/t/prevail-must-not-over-filter-condition/234537/1 "2020-05-27T12:15:31Z")

</div>

Given following document

```auto
{
    "colours": ["red", "yellow", "blue"]
}

```

I want to perfom a query that filters by "red" but I don't want document that has "yellow" even if it has "red".

This is the following query I'm performing:

```auto
{
    "query": {
        "bool": {
            "must_not": [
                {
                    "terms": {
                        "colours": [
                            "yellow"
                        ]
                    }
                }
            ],
            "filter": [
                {
                    "terms": {
                        "colours": [
                            "red"
                        ]
                    }
                }
            ]
        }
    }
}

```

This query is still giving me documents with "yellow" in them.

---

<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:** [June 24, 2020, 12:15pm UTC](https://discuss.elastic.co/t/prevail-must-not-over-filter-condition/234537/2 "2020-06-24T12:15:36Z")

</div>

Closed on June 24, 2020, 12:15pm UTC

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