Parent-Child model problem


(Chris K) #1

With a parent-child relationship set up, I can accomplish certain questions like: I need all parents who have children of two different types. Perhaps I'd use "bool MUST" query with "child type A" and "child type B". If I aggregate on the parent ID field, I essentially get a list of unique parents that meet my query. That's all fine (if I can do that better, let me know).

The problem is what happens when I need a "bool MUST_NOT" filter to be applied. For example, I want "child type A" and I don't want any parents whose children have ANY "type B". Why this fails is because there are one or more children of a certain type. For example, if parent has children of both type A and type B, my not filter will still return this parent.

The only model that works is a nested object whose nested object fields use the "include_in_parent" setting.


(Kevin Bourne) #2

I am having the same problem. Unfortunately similar questions on this forum have seem to go answer-less.


(system) #3