Filtering GraphQL Query by Domains with Nested Domain Structure

Original Slack Thread

Hi, I am trying to write a graphql query that will filter by domains, with a nested domain structure. So say for example I have an asset linked to Domain A, and its parent is Domain B, I would like to include the asset in searches filtered by A.

I noticed if I include a filter like
orFilters: [{ and: {values:["urn:li:domain:A"], field:"domains"} }]
it will only bring back assets directly linked to A. Is there any way I can get back everything from A and all its subdomains?

Hey there! :wave: Make sure your message includes the following information if relevant, so we can help more effectively!

  1. Which DataHub version are you using? (e.g. 0.12.0)
  2. Please post any relevant error logs on the thread!

(this is datahub v0.12.0)

Hi Mat Moore,

Let us know if this query works or not

assets(
filter: {
orFilters: [
{ and: { values: ["urn:li:domain:A"], field: "domains" } },
{ and: { values: ["urn:li:domain:B"], field: "domains" } }, # Parent domain of A
# Add more filters for other potential parent domains
# Add more filters for subdomains of A
]
}
) {
id
name
# Include other fields you need
}
}

Best Regards,

Avani