# How to deal with splitted docs?

**URL:** <https://discuss.elastic.co/t/how-to-deal-with-splitted-docs/218728>\
**Category:** Elasticsearch\
**Created:** [February 11, 2020, 8:31am UTC](https://discuss.elastic.co/t/how-to-deal-with-splitted-docs/218728 "2020-02-11T08:31:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vigen\_Abrahamyan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vigen_abrahamyan/32/62419_2.png) [@Vigen\_Abrahamyan](https://discuss.elastic.co/u/Vigen_Abrahamyan)\
**Post date:** [February 11, 2020, 8:31am UTC](https://discuss.elastic.co/t/how-to-deal-with-splitted-docs/218728/1 "2020-02-11T08:31:20Z")

</div>

Hi.  
We have parent docs indexed in one index and child documents indexed in another. The reason for doing so is

1. performance, since we may have thousand of children docs.
2. to be able to paginate the children separately.

Previous setup was with [nested fields](https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html#nested) but we got performance issues and were not be able to properly paginate the children.

The search requirement is to be able to match against parent + children, i.e. bring the parent which has matching on itself or in children and the matching children as well [optional].

So we are using aggregations for children to get the parent id-s then making another query for parents using `OR` condition to be able to paginate the parents themself.  
i.e. parent has matching OR has id from children matches

The current issue is that the aggregations response could be more than 10k (even multiple times) and we don't want to resolve it changing the config `search.max_buckets` cause it's more or less temporary solution and will perform slow.

Any idea how to deal with this setup/requirement to be able to paginate the parents, paginate children, sort parents, search thru the children only.

Any help will be appreciated !

---

<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:** [March 10, 2020, 8:31am UTC](https://discuss.elastic.co/t/how-to-deal-with-splitted-docs/218728/2 "2020-03-10T08:31:23Z")

</div>

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