# Aggregation on fields within nested objects in elasticsearch

**URL:** <https://discuss.elastic.co/t/aggregation-on-fields-within-nested-objects-in-elasticsearch/135404>\
**Category:** Elasticsearch\
**Created:** [June 11, 2018, 4:11pm UTC](https://discuss.elastic.co/t/aggregation-on-fields-within-nested-objects-in-elasticsearch/135404 "2018-06-11T16:11:53Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 12, 2018, 9:09am UTC](https://discuss.elastic.co/t/aggregation-on-fields-within-nested-objects-in-elasticsearch/135404/4 "2018-06-12T09:09:20Z")

</div>

I was not speaking about the implementation details but about the need.

If you are trying to compute on "item", then index "item" and not a group of items.

> Is there a way to fetch only the corresponding quantity of a given item in an array of items for a given object?

I don't know but may be provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem.

---

_[View the full topic](https://discuss.elastic.co/t/aggregation-on-fields-within-nested-objects-in-elasticsearch/135404)._
