# Retrieving hierarchical content

**URL:** <https://community.prismic.io/t/retrieving-hierarchical-content/126>\
**Category:** Developing with Prismic\
**Tags:** graphql\
**Created:** [April 9, 2020, 2:12pm UTC](https://community.prismic.io/t/retrieving-hierarchical-content/126 "2020-04-09T14:12:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/tim/32/8921_2.png) [@tim](https://community.prismic.io/u/tim)\
**Post date:** [April 9, 2020, 2:12pm UTC](https://community.prismic.io/t/retrieving-hierarchical-content/126/1 "2020-04-09T14:12:29Z")

</div>

What are the limits on the Group field + Content Relationship field? And can it be paginated?

I have setup a data structure per the recommended Option 1 here:

> **[Setting up and retrieving hierarchical content](https://community.prismic.io/t/setting-up-and-retrieving-hierarchical-content/5467)**
>
> There are two different approaches to configuring a hierarchical relationship between two documents. 1. Add the children to the parent document Content modeling You can make it easy for editors to define child pages for a given entry. Modify the...

e.g. category and article types, and I add articles to the category inside the group field + content relationship field.

Per the example below, I can easily retrieve the category data, as well as its child articles using graphql (using ... on Article). But its not obvious what limits there are and how to access pagination?

What if we have added 20+ articles to the category, will they all appear? And if not, how would we paginate this?

```
article_category(uid: "category-name") {
    articles {
        article {
        ... on Article {
                etc...
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [April 10, 2020, 9:34am UTC](https://community.prismic.io/t/retrieving-hierarchical-content/126/2 "2020-04-10T09:34:42Z")

</div>

Hello Tim!

The limits on the Queries depth cannot exceed 9 levels. Beyond this level the query breaks.

For example: Having a Document with a Group, which has a Content Relationship to a Document, and this Document has a Slice and within the Slice there is another Content Relationship to another Document… and so on.

In your case there should not be a problem since you only want to bring a group of Content Relationship fields and possibly only a reference to these documents and not the full content of them.

The group will return all content relationship fields within a group. Pagination is only necessary when querying more than 20 documents at a time (not fields) e.g. +20 article\_category documents.

---

<div class="post-metadata">

**Author:** ![tim](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/tim/32/8921_2.png) [@tim](https://community.prismic.io/u/tim)\
**Post date:** [April 10, 2020, 9:56am UTC](https://community.prismic.io/t/retrieving-hierarchical-content/126/3 "2020-04-10T09:56:03Z")

</div>

Hey Paulina!

Thanks for following up so quickly : )

re: Query depth - thats good to know. And as you said, this shouldn’t be an issue in this particular case, since this query is at most 3 levels deep.

re: Content Relationship fields (within the group field) - thats awesome if it can retrieve all of them at once. The application of this query is for a category page, so the query would return the category page content itself, as well as all of the linked article page references that exist within the group / content relationship field.

I was concerned that if we had more than 20 linked articles then it would not return the additional data beyond that.

Can you advise of an alternate way to retrieve the linked articles for a category page, assuming I am using the same setup as explained above? Is there a way to retrieve all articles that are linked to a page, but using the standard graphql query that uses pagination?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [September 23, 2020, 10:49pm UTC](https://community.prismic.io/t/retrieving-hierarchical-content/126/5 "2020-09-23T22:49:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 5:42pm UTC](https://community.prismic.io/t/retrieving-hierarchical-content/126/6 "2021-12-09T17:42:37Z")

</div>


