How to query parent with no children


(Keith Garrod) #1

I have a parent document with optional children.

I want to find all parents with NO (0) children.

It seems the only way to query children is the 'has_child' filter. I have tried setting min_children and max_children to 0 but I don't get the results I want.

Any suggestions please?


(Taras Kohut) #2

This Stack Overflow answer should help: