Terms aggregation with include

Hello. Here is my problem:
I have query to get data for specific vendorCode in specific range - lines 3-13.
Than I want to get aggregations on videoViews for all data vendor have - lines 14-18
Than I need to create two buckets - "Channel One" and "Channel Two". Those two buckets should "include" only contentIds that are stated in list of "include" filter: line 23 and line 37.
The last thing I need to do is to calculate videoViews for each CHANNEL NAME. But what I got here (line 26-30) is calculating videoViews for each CONTENT ID instead.
How can I get videoViews total FOR EACH CHANNEL INSTEAD of for each content id in this channel?

**Without changing mapping, adding scripts or adding channel name fields to ES index

Please don't post images of text as they are hardly readable and not searchable.

Instead paste the text and format it with </> icon. Check the preview window.

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