# Passing Parent Aggregate Key into the child Aggregate Scripting language

**URL:** <https://discuss.elastic.co/t/passing-parent-aggregate-key-into-the-child-aggregate-scripting-language/242398>\
**Category:** Elasticsearch\
**Created:** [July 23, 2020, 8:23pm UTC](https://discuss.elastic.co/t/passing-parent-aggregate-key-into-the-child-aggregate-scripting-language/242398 "2020-07-23T20:23:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amrit.khatri](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@amrit.khatri](https://discuss.elastic.co/u/amrit.khatri)\
**Post date:** [July 23, 2020, 8:23pm UTC](https://discuss.elastic.co/t/passing-parent-aggregate-key-into-the-child-aggregate-scripting-language/242398/1 "2020-07-23T20:23:16Z")

</div>

I have a quick question about passing the filters key to the scripted language from parent aggregate to child aggregate.

Basically, I have defined the filters as below, In my scripted query, I want to use the filter key month as part of the DOM average calculation. In my example, I have hardcoded a date value, but it should be the key value of the filters definition. Would appreciate it if anyone could give me some feedback on how that could be worked out.

 ![ESQuestion](https://us1.discourse-cdn.com/elastic/original/3X/a/0/a0fe481835742656bd10c99a2d61987cdf11bb82.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 20, 2020, 8:23pm UTC](https://discuss.elastic.co/t/passing-parent-aggregate-key-into-the-child-aggregate-scripting-language/242398/2 "2020-08-20T20:23:31Z")

</div>

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