Prevail must_not over filter condition

Given following document

{
    "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:

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

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

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