Skip to main content
Question

Unpredicted metadata_query_restricted

  • May 22, 2025
  • 3 replies
  • 15 views

Forum|alt.badge.img

Good day.

 

My folder structure is like:

  • Folder A
       <5k files>
  • Folder B
       <1 file>
       <Folder B.2>
          <1 file>
  • Folder C
       <a complex structure with 2k files>

Each file in these three folders are linked to the same metadata template.

So, i'm trying to search by these files using metadata search api:

        const from = 'enterprise_XXXXX.XXXXX';
        const options = {
            fields: [
                "id",
                "name",
                "metadata.enterprise.XXXXXX.documentTitle"
            ],
            limit: 10,
            order_by: [
                {
                    field_key: 'XXXXXX',
                    direction: 'asc'
                }
            ],
        };
        const response = await client.metadata.query(from, XXXXXXX, options);

When i do that for Root Folder (0) or Folder A  it works perfectly, but when i do the same request for Folder B or Folder C it cause:

metadata_query_restricted - Metadata Query API found either too many items outside the ancestor folder or too many inaccessible items matching the query.

Any ideas why?

PS: In the same way usage of a client.search.query with mdfilters works perfectly for each folder from above.

What i'm doing from business side:

We needs to have ability to order the search result not only by relevant but also by some attributes from template, and it's why i were forced to migrate from search.query to the metadata.search. Also, i lost the content search functionality and it's a but sad.

3 replies

Forum|alt.badge.img

Hi there, 

Welcome to the Box Community! 

This issue should be best addressed by our Product Support. I have created a ticket for you and kindly check your Inbox for updates. 

Thanks!


Forum|alt.badge.img

Did this ever get resolved?  I am facing a similar issue with the metadata_query_restricted error and would love to learn more details of a possible cause and solution.


Forum|alt.badge.img

I am suddenly having the same issue. Any fix yet?