Joining across doc types



I have a few different documents:
Category - contains info about a subject area
Channel - created by a user and is associated to a Category
Posts - created by user and associated to a channel

Within the post document I have a score attribute, ie
{ type: “post”,
postId: “123”,
channelId: “channel:abc”,
score: 1024

channel:abc looks like:
{ type: “channel”,
channelId: “channel:abc”,
category: “category:birds”

I want to get back all the channels that belong to a specific category (or all categories) ordered by the summed score from all of the posts within that specific channel. Category does not exist within the Post doc since the user can move channels to different categories and I want all posts to automatically then show up under that category.

How do I do this?


I have the same issue.

Can you please help me ?