# When a search hits a document, how can ES only return parts of that document?

**URL:** <https://discuss.elastic.co/t/when-a-search-hits-a-document-how-can-es-only-return-parts-of-that-document/12668>\
**Category:** Elasticsearch\
**Created:** [July 4, 2013, 4:58pm UTC](https://discuss.elastic.co/t/when-a-search-hits-a-document-how-can-es-only-return-parts-of-that-document/12668 "2013-07-04T16:58:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![11122](https://avatars.discourse-cdn.com/v4/letter/1/6a8cbe/32.png) [@11122](https://discuss.elastic.co/u/11122)\
**Post date:** [July 4, 2013, 4:58pm UTC](https://discuss.elastic.co/t/when-a-search-hits-a-document-how-can-es-only-return-parts-of-that-document/12668/1 "2013-07-04T16:58:25Z")

</div>

I have a document with nested types and I use nested query to search on the  
nested part.  
Now I get a hit and the search result returned is the whole doc.  
Could anyone tell me how can I get only this nested part or the part of  
document which contains this nested part?  
Should I use parent-child? Or using nested types can also meet my  
requirement?  
Thanks!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [July 5, 2013, 7:59pm UTC](https://discuss.elastic.co/t/when-a-search-hits-a-document-how-can-es-only-return-parts-of-that-document/12668/2 "2013-07-05T19:59:23Z")

</div>

Nested types do not support returning only the relevant nested docs (as of  
now).

--  
Ivan

On Thu, Jul 4, 2013 at 9:58 AM, 少爷允之 [chang.zhang29@googlemail.com](mailto:chang.zhang29@googlemail.com) wrote:

> I have a document with nested types and I use nested query to search on  
> the nested part.  
> Now I get a hit and the search result returned is the whole doc.  
> Could anyone tell me how can I get only this nested part or the part of  
> document which contains this nested part?  
> Should I use parent-child? Or using nested types can also meet my  
> requirement?  
> Thanks!
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:27am UTC](https://discuss.elastic.co/t/when-a-search-hits-a-document-how-can-es-only-return-parts-of-that-document/12668/3 "2017-07-06T02:27:54Z")

</div>


