MUST_NOT not working with EXIST in NESTED query

If instead of putting the must_not inside your nested query, you put the nested query inside of a must_not, it should work:

POST players/players/_search
{
  "query": {
    "bool": {
      "must_not": [
        {
          "nested": {
            "path": "features",
            "query": {
              "exists": {
                "field": "features"
              }
            }
          }
        }
      ]
    }
  }
}
9 Likes