Max_children,0 does not appear to work in has_child filter?


#1

I want to be able to select parents that don't have any children matching a particular set of criteria. I thought that if I did:

        {
          "has_child": {
            "max_children": 0,
            "type": "event",
            "filter": {
              "bool": {
                "must": [
                  {
                    "bool": {
                      "must": [
                        {
                          "term": {
                            "cs_e": "eventF"
                          }
                        }
                      ],
                      "should": [],
                      "mustNot": []
                    }
                  }
                ],
                "should": [],
                "mustNot": []
              }
            }
          }
        }

then this would return me parents who had a maximum of 0 children - ie the parents that don't match. Curiously, however, I do get one parent back from the query, and that parent has one child that matches.

Is this expected? (Possibly I have messed up somewhere or misunderstood)?

Many thanks!


#2

Hey there -> did you ever get an answer to this question? I am running into the same issue


(system) #3