# Collapse field on parent/child

**URL:** <https://discuss.elastic.co/t/collapse-field-on-parent-child/82904>\
**Category:** Elasticsearch\
**Created:** [April 19, 2017, 2:11pm UTC](https://discuss.elastic.co/t/collapse-field-on-parent-child/82904 "2017-04-19T14:11:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gianni\_Livolsi](https://avatars.discourse-cdn.com/v4/letter/g/41988e/32.png) [@Gianni\_Livolsi](https://discuss.elastic.co/u/Gianni_Livolsi)\
**Post date:** [April 19, 2017, 2:11pm UTC](https://discuss.elastic.co/t/collapse-field-on-parent-child/82904/1 "2017-04-19T14:11:39Z")

</div>

Is it allowed collapse using parent child..??

I've an index with 2 types user and posts, posts are children of user, i want search in posts and get it collapsed on user,

i wan to get hits of users with their posts in inner\_hits.

It's easy to do if i put user value in any post.... my question is can i do it using parent/child relation..???

Tnx

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [April 21, 2017, 7:11am UTC](https://discuss.elastic.co/t/collapse-field-on-parent-child/82904/2 "2017-04-21T07:11:10Z")

</div>

Yes, you can field collapse on the \_parent field. The field you should use depends on the parent type name, so assuming the parent type name is user, you should use `_parent#user` as collapse field.

---

<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:** [May 19, 2017, 7:21am UTC](https://discuss.elastic.co/t/collapse-field-on-parent-child/82904/3 "2017-05-19T07:21:37Z")

</div>

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