# Missing aggregation on nested field returning incorrect results

**URL:** <https://discuss.elastic.co/t/missing-aggregation-on-nested-field-returning-incorrect-results/54324>\
**Category:** Elasticsearch\
**Created:** [June 29, 2016, 6:00pm UTC](https://discuss.elastic.co/t/missing-aggregation-on-nested-field-returning-incorrect-results/54324 "2016-06-29T18:00:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![schmichael\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/schmichael_2/32/1249_2.png) [@schmichael\_2](https://discuss.elastic.co/u/schmichael_2)\
**Post date:** [June 29, 2016, 6:00pm UTC](https://discuss.elastic.co/t/missing-aggregation-on-nested-field-returning-incorrect-results/54324/1 "2016-06-29T18:00:14Z")

</div>

I'm trying to do a missing aggregation on a nested field, but it doesn't appear to give correct results.

Full test case: [https://gist.github.com/schmichael/131e3a16251e75abd637eed498015ee8](https://gist.github.com/schmichael/131e3a16251e75abd637eed498015ee8)

Note I included a nested missing aggregation to demonstrate that doesn't do what I had hoped either.

---

<div class="post-metadata">

**Author:** ![schmichael\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/schmichael_2/32/1249_2.png) [@schmichael\_2](https://discuss.elastic.co/u/schmichael_2)\
**Post date:** [June 29, 2016, 10:37pm UTC](https://discuss.elastic.co/t/missing-aggregation-on-nested-field-returning-incorrect-results/54324/2 "2016-06-29T22:37:53Z")

</div>

Reverse nested seems to be what I was looking for: [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-reverse-nested-aggregation.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-reverse-nested-aggregation.html)

---

<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 5, 2017, 10:39pm UTC](https://discuss.elastic.co/t/missing-aggregation-on-nested-field-returning-incorrect-results/54324/3 "2017-07-05T22:39:28Z")

</div>


