My gist here: https://gist.github.com/wflanagan/eb44812a9272c0528b73 has the mapping, the query, and the results.
I'm trying to do a, what I thought was simple, nested in nested query. For a document, PageStat, I have "by_goals" nested document that has a by_sources nested document inside it. I'm just trying to aggregate for a "PageStat" the source_id counts by goal for that page by day.
According to SO, this should work. However, I haven't manage to get this done. 4 frigging days.