# Nested object, childrens or ? - Need to highlight results

**URL:** <https://discuss.elastic.co/t/nested-object-childrens-or-need-to-highlight-results/51157>\
**Category:** Elasticsearch\
**Created:** [May 27, 2016, 12:33pm UTC](https://discuss.elastic.co/t/nested-object-childrens-or-need-to-highlight-results/51157 "2016-05-27T12:33:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ulrik\_Pedersen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ulrik_pedersen/32/11352_2.png) [@Ulrik\_Pedersen](https://discuss.elastic.co/u/Ulrik_Pedersen)\
**Post date:** [May 27, 2016, 12:33pm UTC](https://discuss.elastic.co/t/nested-object-childrens-or-need-to-highlight-results/51157/1 "2016-05-27T12:33:16Z")

</div>

My goal is to index 'Documents Profiles' which all can hold multiple 'Document Files' and then execute a Full Text Search on the complete document returning with the \_source of the Document Profile AND a highlight of the matching results.

The data model is something like this.

A 'Document profile' has some meta data like

- Revision
- Relations
- Etc.

A 'Document file' consists of things like

- Filename
- Filepath
- File Size
- File Metadata
- File Content

My first thought was to make the 'Document files' nested objects of the 'Document profile' and throw a nested query at it - but my experience has been that it's not possible to get a highlight of the 'File Content' hits with this type of mapping.

Are there any workarounds for this or do I need to make a Parent/Child relationship between the 'Document Profiles' and 'Document Files' instead and then throw multiple queries at ES and join the results in my application to obtain a Full Text Search working on both the 'Document Profile' and the 'Document Files' whilst returning with a highlighting?

---

<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:48pm UTC](https://discuss.elastic.co/t/nested-object-childrens-or-need-to-highlight-results/51157/2 "2017-07-05T22:48:29Z")

</div>


