# Questions about nested objects

**URL:** <https://discuss.elastic.co/t/questions-about-nested-objects/81874>\
**Category:** Elasticsearch\
**Created:** [April 10, 2017, 9:07pm UTC](https://discuss.elastic.co/t/questions-about-nested-objects/81874 "2017-04-10T21:07:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dng](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@dng](https://discuss.elastic.co/u/dng)\
**Post date:** [April 10, 2017, 9:07pm UTC](https://discuss.elastic.co/t/questions-about-nested-objects/81874/1 "2017-04-10T21:07:41Z")

</div>

Questions about nested objects:

1. Can you limit the query response to only those nested objects that have a match?
2. Is there a way to limit the number of nested object returned in the query response by a fixed number?
3. Is there a way to page through the nested objects, instead of returning them all together?

All these questions stem from the fact that we might be facing a scenario with a lot of nested objects, and we don't necessarily want to get all of them all the time.

Any help will be appreciated. Thanks!

---

<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:** [April 10, 2017, 10:18pm UTC](https://discuss.elastic.co/t/questions-about-nested-objects/81874/2 "2017-04-10T22:18:51Z")

</div>

Take a look at inner hits:  
[https://www.elastic.co/guide/en/elasticsearch/reference/5.3/search-request-inner-hits.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/search-request-inner-hits.html)

It will solve most issues except the last one. There might be something  
related to paging inner hits in 5.3. If not, it is definitely an open issue.

Ivan

---

<div class="post-metadata">

**Author:** ![dng](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@dng](https://discuss.elastic.co/u/dng)\
**Post date:** [April 11, 2017, 12:35pm UTC](https://discuss.elastic.co/t/questions-about-nested-objects/81874/3 "2017-04-11T12:35:40Z")

</div>

Thanks Ivan! This is exactly what I am looking for.  
Looks like we can also page by using the "from" and "size" option.

---

<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 9, 2017, 12:50pm UTC](https://discuss.elastic.co/t/questions-about-nested-objects/81874/4 "2017-05-09T12:50:00Z")

</div>

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