# Excluding certain entities from data explorer query

**URL:** <https://community.dynatrace.com/t/excluding-certain-entities-from-data-explorer-query/46352>\
**Category:** Dashboarding\
**Tags:** data-explorer\
**Created:** [June 27, 2024, 9:29pm UTC](https://community.dynatrace.com/t/excluding-certain-entities-from-data-explorer-query/46352 "2024-06-27T21:29:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulito](https://avatars.discourse-cdn.com/v4/letter/p/e19adc/32.png) [@paulito](https://community.dynatrace.com/u/paulito)\
**Post date:** [June 27, 2024, 9:29pm UTC](https://community.dynatrace.com/t/excluding-certain-entities-from-data-explorer-query/46352/1 "2024-06-27T21:29:16Z")

</div>

First off we’re using a custom extension so hopefully that doesn’t put us in too much of a bind but here is our query:

```markup
nagios._Check_CPU_Load.load1:filter(and(or(in("dt.entity.custom_device",entitySelector("type(custom_device),fromRelationship.isInstanceOf(type(CUSTOM_DEVICE_GROUP),entityName.equals(~"Blahblahblah~"))"))))):splitBy("dt.entity.custom_device"):sort(value(auto,descending))

```

This gives us a list of devices. We’d like to exclude 3 devices from this query. These 3 devices have a common word in their name: “test”.

Is there something we can add to our existing query so that those 3 devices are excluded?

---

<div class="post-metadata">

**Author:** ![stemos](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@stemos](https://community.dynatrace.com/u/stemos)\
**Post date:** [July 18, 2024, 11:00am UTC](https://community.dynatrace.com/t/excluding-certain-entities-from-data-explorer-query/46352/2 "2024-07-18T11:00:27Z")

</div>

The following embedded entity selector can be used:

```auto
"type(custom_device),not(entityName.contains(~"test~")),fromRelationship.isInstanceOf(type(CUSTOM_DEVICE_GROUP),entityName.equals(~"Blahblahblah~"))"

```

---

<div class="post-metadata">

**Author:** ![paulito](https://avatars.discourse-cdn.com/v4/letter/p/e19adc/32.png) [@paulito](https://community.dynatrace.com/u/paulito)\
**Post date:** [July 31, 2024, 5:18pm UTC](https://community.dynatrace.com/t/excluding-certain-entities-from-data-explorer-query/46352/3 "2024-07-31T17:18:54Z")

</div>

Thank you so much, this works. Would there be a way to exclude multiple entities that have unique names?

---

<div class="post-metadata">

**Author:** ![stemos](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@stemos](https://community.dynatrace.com/u/stemos)\
**Post date:** [August 20, 2024, 7:42am UTC](https://community.dynatrace.com/t/excluding-certain-entities-from-data-explorer-query/46352/4 "2024-08-20T07:42:16Z")

</div>

Yes, you can exclude unique names by:

```auto
"type(custom_device),not(entityName.in(~"full_device_name1~",~"full_device_name2~",~"full_device_name3~"))"

```

If you want to exclude multiple devices based on the contains filter, you can achieve this like shown in this example:

```markup
"type(custom_device),not(entityName.contains(~"abc~")),not(entityName.contains(~"cbd~")),not(entityName.contains(~"bde~"))"

```
