Document design for querying related documents efficiently

I've looked into the "Parent Field" but from my understanding it won't work
for what I'm trying to do, but I mention it because it's very similar. The
use case is a reporting system where we need to have some access control.
Consider these 3 documents:

parent_type_1
parent_type_2
child_type_1

The query needs to pull all of the child records where the user is listed
as an owner in either of the parent records.

Both parent types have a field called "owners" that list the users that
should have access to the parent records.

The child type has a reference to one or two parent types. I believe that
if it only referenced a single parent type, the "Parent Field" would be the
perfect solution.

We're considering just adding an extra step in the application layer to
copy the owners from parent to child whenever a parent is modified, but
this feels clunky.

We're using routing to ensure that related parent and child records will
always be on the same shard if that makes a difference.

Any suggestions would be much appreciated.

Nick

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.