# Top hits aggregation does not work on nested object

**URL:** <https://discuss.elastic.co/t/top-hits-aggregation-does-not-work-on-nested-object/336347>\
**Category:** Elasticsearch\
**Tags:** eql-elastic-query-language\
**Created:** [June 19, 2023, 9:57am UTC](https://discuss.elastic.co/t/top-hits-aggregation-does-not-work-on-nested-object/336347 "2023-06-19T09:57:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JasonREC](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@JasonREC](https://discuss.elastic.co/u/JasonREC)\
**Post date:** [June 19, 2023, 9:57am UTC](https://discuss.elastic.co/t/top-hits-aggregation-does-not-work-on-nested-object/336347/1 "2023-06-19T09:57:18Z")

</div>

Hi all,

This is my nested object field

 ![final-help](https://us1.discourse-cdn.com/elastic/original/3X/b/1/b1a1a3fbe44d27604ca4316e866e0bc139dda70a.png)

And, I manually update the mapping like this

 ![nested](https://us1.discourse-cdn.com/elastic/original/3X/6/2/62b4894514d4639c2576087e6685c4aa204c124d.png)

And, this is how my top\_hit query look like

 ![path_nested](https://us1.discourse-cdn.com/elastic/original/3X/f/5/f52ebdd0316ba8417824412e3874b80ca9789ae0.png)

Lastly, this is the query response

 ![query-r](https://us1.discourse-cdn.com/elastic/original/3X/3/2/32437ad9bf9c849e1031ce3a435b4cbc8da7d17e.png)

I expected it should be return the entire "final-help-data" field.

Could anyone help me out? Thanks

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [June 21, 2023, 10:29am UTC](https://discuss.elastic.co/t/top-hits-aggregation-does-not-work-on-nested-object/336347/2 "2023-06-21T10:29:19Z")

</div>

Hi @JasonREC,

Can you share your full query as `code` instead of an image? Can you also share an example of what you are expecting to see? I'm not quite clear what results your expect.

---

<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 19, 2023, 10:29am UTC](https://discuss.elastic.co/t/top-hits-aggregation-does-not-work-on-nested-object/336347/3 "2023-07-19T10:29:33Z")

</div>

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