Cardinality Pipeline

I have what seems to be like a pipelined bucket aggregation with cardinality. I have two types of documents: Accounts and Reports.

An account loosely looks like this

type AccountDoc struct {
    AccountAlias    string `json:"account_alias"`
    AccountEnrolled bool   `json:"account_enrolled"`
}

And a report loosely looks like this

type ReportingDoc struct {
    ID          string   `json:"id,omitempty"`
    Enrolled    bool     `json:"enrolled"`
    AllAccounts []string `json:"all_accounts,omitempty"`
}

The goal is "for every unique AccountAlias give me the number of Reports that include the AccountAlias in the array AllAccounts"

It seems like I would need some form of a nested query/aggregation which to me sounds like a pipeline but im also bucketing by unique AccountAlias

I am not married to the document schema for the AccountDoc, but I am married to the goal.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.