# Paginating nested documents

**URL:** <https://discuss.elastic.co/t/paginating-nested-documents/31739>\
**Category:** Elasticsearch\
**Created:** [October 6, 2015, 10:26pm UTC](https://discuss.elastic.co/t/paginating-nested-documents/31739 "2015-10-06T22:26:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgiraldo](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@mgiraldo](https://discuss.elastic.co/u/mgiraldo)\
**Post date:** [October 6, 2015, 10:26pm UTC](https://discuss.elastic.co/t/paginating-nested-documents/31739/1 "2015-10-06T22:26:27Z")

</div>

I have a `person` document that has many nested `address` documents.

If I have, say 10 persons, each with 5 addresses the total documents is 50, right?

Is it possible to make the `hits.total` always be the person count (or some alternative)? I want to be able to paginate queries by persons (I've got tens of thousands of persons/addresses) and getting the raw document count is not very helpful.

---

<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, 11:46pm UTC](https://discuss.elastic.co/t/paginating-nested-documents/31739/2 "2017-07-05T23:46:21Z")

</div>


