Combining must, should, and must_not

Hello, I am working with elasticsearch within Gentics Mesh CMS and I'm trying to construct a query that returns a series of nodes. I have two nodes tagged with keywordA. One of those nodes has tag keywordB. Based on the following query, I would expect to see one node returned, however I see two.

{
    "query": {
        "nested": {
            "ignore_unmapped": "true",
            "path": "tagFamilies.keywords.tags",
            "query": {
                "bool": {
                    "must": [
                        {
                            "match_phrase": {
                                "tagFamilies.keywords.tags.name": "keywordA"
                            }
                        }
                    ],
                    "must_not": [
                        {
                            "match": {
                                "tagFamilies.keywords.tags.name": "keywordB"
                            }
                        }
                    ]
                }
            }
        }
    }
}

Does this syntax look accurate, or am I missing something?
Thanks in advance

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