Using GraphQL search method with specified container URN to filter datasets by tag

Original Slack Thread

Hi team!
I figure out how to use search method in GraphQL within specified container URN, and cant find solution for it

This example of raw search that output list of datasets from all Datasources with tag “SOME_TAG”
query searchTags ($input: SearchInput!){
search(input: $input){
start
count
total
searchResults {
entity {
urn
type
...on Dataset {
name

                `}`
            `}`
            `matchedFields {`
                `name`
                `value`
            `}`
        `}`
    `}`
`}`

{
"input": {
"start": 0,
"count": 100,
"type": "DATASET",
"query": "catalog:",
"orFilters": [{"and": [{"field": "tags", "values": "urn:li:tag:SOME_TAG"}]}]
}
}

I’m pretty sure that should be something like this for extending filters:

{
"input": {
"start": 0,
"count": 100,
"type": "DATASET",
"query": "",
"orFilters": [{"and": [{"field": "tags", "values": "urn:li:tag:SOME_TAG"}, {"field": "contanier", "values": "urn:li:contanier:SOME_CONTAINER_URN_TO_SEARCH_IN"}]}]
}
}

My goal - is get all datasets with tag from selected container or Platform Instance

To get all DataSets, which contain something in urn, you can use next query:
query search {
search(
input: {
type: DATASET,
query: "*",
start: 0,
count: 5,
orFilters: [
{
and: [
{
condition: CONTAIN
negated: false
field: "urn"
values: ["something"]
}
]
}
]
}
) {
start
count
total
searchResults {
entity {
urn
type
... on Dataset {
name
platform {
name
}
}
}
}
}
}

if you want to find specific urn, you can specify in filter: condition - EQUALS and in values - list of urns you want to find

<@U061JLXFEG0>, thank for the answer!

Just checked your sniped. But, unfortunate its little bit another result, not exactly that i expect :disappointed:

Maybe my explanation was not good enough.
Let me try in another way.
In my Datahub instance i have some amount tags, for e.g. “Tag_A” applied on DATASETS’s from various data sources like Oracle, PostgreSQL, S3, etc.

Query for search that i trying to configure should get as input container urn that represent specific data source and produce list of DATASET’s as search output with tag “Tag_A”. Hope its clear enough)

Perhaps, I’m trying to use “search” function in wrong way

Your query contains a typo - contanier => container