# error when adding Disks to Hosts limiting results

**URL:** <https://community.dynatrace.com/t/error-when-adding-disks-to-hosts-limiting-results/51282>\
**Category:** DQL\
**Tags:** dql\
**Created:** [April 18, 2025, 1:26am UTC](https://community.dynatrace.com/t/error-when-adding-disks-to-hosts-limiting-results/51282 "2025-04-18T01:26:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandon\_camp](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@brandon\_camp](https://community.dynatrace.com/u/brandon_camp)\
**Post date:** [April 18, 2025, 1:26am UTC](https://community.dynatrace.com/t/error-when-adding-disks-to-hosts-limiting-results/51282/1 "2025-04-18T01:26:45Z")

</div>

My error is similar to this post that I don’t see a resolution for: [https://community.dynatrace.com/t5/DQL/DQL-Relationship-Query-returning-too-many-entity-IDs/m-p/229409](https://community.dynatrace.com/post/229409)

I am running the DQL below which results in error: “The number of entity IDs in the relationship fields has been limited. Please try filtering or narrowing your timeframe.”

```auto
<font face="courier new,courier">fetch dt.entity.host
| fieldsAdd tags
| expand tags
| filter contains(tags, "Portfolio:")
| parse tags, """((LD:tag (!<<'\\' ':') LD:value)|LD:tag)"""
| filter value == $Portfolio
| fieldsRemove tags, tag, value
| fieldsAdd disks = contains[dt.entity.disk]
// the error happens for this operation above ^^^^
| expand disks
| fields disks</font>

```

I tried increasing my Query Limits but no change in the error.

DQL objective:

1. Get the Hosts and filter for any Hosts where Tag ‘Portfolio:’ equals the $Portfolio variable
2. Get the Disks associated with the Host - adding the list of Disks is where the error occurs
3. Expand each Disk into a row

As soon as I expand disks the error occurs. In my environment for this scenario there are 417 Hosts matching the $Portfolio tag which then expands into at least 9,984 Disks (could be more due to error limits).

Any ideas how to get around this error limit?

---

<div class="post-metadata">

**Author:** ![marco\_irmer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marco_irmer/32/3038_2.png) [@marco\_irmer](https://community.dynatrace.com/u/marco_irmer)\
**Post date:** [April 18, 2025, 12:40pm UTC](https://community.dynatrace.com/t/error-when-adding-disks-to-hosts-limiting-results/51282/2 "2025-04-18T12:40:04Z")

</div>

I think the workaround here would be to reverse the logic of the query, where you fetch dt.entity.disk and then use the belongs\_to relationship to identify the host, before finally filtering on the portfolio value.

---

<div class="post-metadata">

**Author:** ![brandon\_camp](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@brandon\_camp](https://community.dynatrace.com/u/brandon_camp)\
**Post date:** [April 18, 2025, 5:49pm UTC](https://community.dynatrace.com/t/error-when-adding-disks-to-hosts-limiting-results/51282/3 "2025-04-18T17:49:10Z")

</div>

Thanks Marco.&nbsp;&nbsp;I reversed the DQL sequence and it does sidestep the error.&nbsp; Updated logical sequence is now:

1. Fetch all Disks and add Host Id field from belongs\_to
2. Join with nested fetch containing: all Hosts filtered for ‘Portfolio’ tag value equal to $Portfolio variable
3. Tidy up fields in result

This then allowed me to get to my next stumbling block which I will post about separately.&nbsp; Thanks!
