# Aggregate children data

**URL:** <https://discuss.elastic.co/t/aggregate-children-data/17468>\
**Category:** Elasticsearch\
**Created:** [May 13, 2014, 1:23am UTC](https://discuss.elastic.co/t/aggregate-children-data/17468 "2014-05-13T01:23:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vlad\_Mangeym](https://avatars.discourse-cdn.com/v4/letter/v/a698b9/32.png) [@Vlad\_Mangeym](https://discuss.elastic.co/u/Vlad_Mangeym)\
**Post date:** [May 13, 2014, 1:23am UTC](https://discuss.elastic.co/t/aggregate-children-data/17468/1 "2014-05-13T01:23:59Z")

</div>

I am looking for help/ideas/examples. Thank you in advance for your help.

I have 3 types of docs loaded into elastic search: "parent", "child1", "child2" ("child1", "child2" have "parent" type set as parent in the mapping).  
"parent" documents have among other fields "factor1":[some number], "factor2":[some number]. There are about 20,000 documents each with multiple children of both types, with total number or children of each type across all parents 250,000 (500,000 total). Each child document has a field "amount":[some number].

I need to find a value for each parent that is the sum of all "child1" amounts multiplied by "parent" "factor1" divided by sum of all "child2" amounts multiplied by "factor2".

I need to be able to get it for each parent and to be able to search by it: find all parents that have value between 0.4 and 0.8 for example...

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9ca7c521-7402-41e5-8610-c05444e408f0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9ca7c521-7402-41e5-8610-c05444e408f0%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:29am UTC](https://discuss.elastic.co/t/aggregate-children-data/17468/2 "2017-07-06T01:29:56Z")

</div>


