Use keyword-only search in Knowledge Catalog to find resources using specific keywords, filters, and a defined syntax. Keyword-only search provides precise control over your search queries and lets you narrow down results based on metadata fields.
Before you begin
Before you perform search, ensure that you are granted the required roles and have enabled the necessary API.
Required roles
To get the permissions that you need to search for entries and access search results in Knowledge Catalog, ask your administrator to grant you the following IAM roles:
-
Search for entries:
- Dataplex Catalog Admin (
roles/dataplex.catalogAdmin) on the project used for search - Dataplex Catalog Editor (
roles/dataplex.catalogEditor) on the project used for search - Dataplex Catalog Viewer (
roles/dataplex.catalogViewer) on the project used for search
- Dataplex Catalog Admin (
-
Search for metadata for BigQuery datasets and tables:
BigQuery Metadata Viewer (
roles/bigquery.metadataViewer) on the dataset or table -
Search for custom entries:
Dataplex Catalog Viewer (
roles/dataplex.catalogViewer) on the project
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Use keyword-only search
Console
To search for resources using keyword search, follow these steps:
In the Google Cloud console, go to the Knowledge Catalog Search page.
If your search platform is set to Data Catalog, in the Choose search platform menu, select Knowledge Catalog.
In the Find resources across projects field, enter your query.
To refine your search, use the Filters panel. The following filters are available:
- Systems provide a list of available systems, such as BigQuery or Cloud SQL. The Knowledge Catalog system contains custom entries.
- Aspects (tags) let you query for assets tagged using a specific template. You can use the Customize menu to further refine results and filter by specific aspect values.
- Project lists the projects you can scope the search to.
- Type aliases are data types associated with an entry type. An entry type might have the name
projects/test-project/locations/us/entryTypes/my-entry-type, but you can search for it using its type aliasesTABLEorDATABASE. You can set one or more type aliases when you create or update an entry type. - Datasets come from BigQuery.
You can manually add the following filters:
- Add a project filter: in Project, click Add project. Search for a specific project, select the project, and then click Open.
- Add an aspect type filter: in Aspects, click the Add more aspect types menu. Search for a specific template, select it, and then click OK.
Optional: In addition to the assets available to you, you can search for resources that are publicly available in Google Cloud by selecting Include public datasets.
Use the following tips to construct a search query:
- Enclose your search expression in quotes if it contains spaces. For example,
"search terms". - Precede a keyword with
NOTto match the logical negation of thekeyword:termfilter. You can also useANDandORBoolean operators to combine search expressions. TheAND,OR, andNOToperators aren't case-sensitive.
For example,
NOT column:termlists all columns except those that match the specified term.- Enclose your search expression in quotes if it contains spaces. For example,
To view more information about the searched resource, in the search results, click the resource name. This opens the entry details page.
gcloud
To search for resources, use the
gcloud dataplex entries search command.
C#
Before trying this sample, follow the C# setup instructions in the
Knowledge Catalog quickstart using
client libraries.
For more information, see the
Knowledge Catalog C# API
reference documentation.
To authenticate to Knowledge Catalog, set up Application Default Credentials.
For more information, see
Set up authentication for a local development environment.
C#
Go
Before trying this sample, follow the Go setup instructions in the
Knowledge Catalog quickstart using
client libraries.
For more information, see the
Knowledge Catalog Go API
reference documentation.
To authenticate to Knowledge Catalog, set up Application Default Credentials.
For more information, see
Set up authentication for a local development environment.
Go
Java
Before trying this sample, follow the Java setup instructions in the
Knowledge Catalog quickstart using
client libraries.
For more information, see the
Knowledge Catalog Java API
reference documentation.
To authenticate to Knowledge Catalog, set up Application Default Credentials.
For more information, see
Set up authentication for a local development environment.
Java
Node.js
Before trying this sample, follow the Node.js setup instructions in the
Knowledge Catalog quickstart using
client libraries.
For more information, see the
Knowledge Catalog Node.js API
reference documentation.
To authenticate to Knowledge Catalog, set up Application Default Credentials.
For more information, see
Set up authentication for a local development environment.
Node.js
PHP
Before trying this sample, follow the PHP setup instructions in the
Knowledge Catalog quickstart using
client libraries.
For more information, see the
Knowledge Catalog PHP API
reference documentation.
To authenticate to Knowledge Catalog, set up Application Default Credentials.
For more information, see
Set up authentication for a local development environment.
PHP
Python
Before trying this sample, follow the Python setup instructions in the
Knowledge Catalog quickstart using
client libraries.
For more information, see the
Knowledge Catalog Python API
reference documentation.
To authenticate to Knowledge Catalog, set up Application Default Credentials.
For more information, see
Set up authentication for a local development environment.
Python
Ruby
Before trying this sample, follow the Ruby setup instructions in the
Knowledge Catalog quickstart using
client libraries.
For more information, see the
Knowledge Catalog Ruby API
reference documentation.
To authenticate to Knowledge Catalog, set up Application Default Credentials.
For more information, see
Set up authentication for a local development environment.
Ruby
REST
To search for resources, use the
searchEntries method.
Keyword-only search syntax
For precise searches, you can construct a query using specific syntax, including qualifiers, logical operators, and aspect searches.
Qualified predicates
You can qualify a predicate by prefixing it with a key that restricts the matching to a specific piece of metadata:
- An equal sign (
=) restricts the search to an exact match. - A colon (
:) after the key matches the predicate to either a substring or a token within the value in the search results.
Tokenization splits the stream of text into a series of tokens, with each token usually corresponding to a single word.
The predicate keys type, system, location, and orgid support only the
exact match (=) qualifier, not the substring qualifier (:). For example,
type=foo or orgid=number.
Knowledge Catalog keyword search supports the following qualifiers:
| Qualifier | Description |
|---|---|
name:x |
Matches x as a substring of the resource ID. |
displayname:x |
Matches x as a substring of the resource display name. |
column:x |
Matches x as a substring of the column name (or nested
column name) in the schema of the resource. |
description:x |
Matches x as a token in the resource description. |
label:bar |
Matches BigQuery resources that have a label (with some
value) and the label key has bar as a substring. |
label=bar |
Matches BigQuery resources that have a label (with
some value) and the label key equals bar as a string. |
label:bar:x |
Matches x as a substring in the value of a label with
key bar attached to a BigQuery resource. |
label=foo:bar |
Matches BigQuery resources where the key equals
foo and the key value equals bar. |
label.foo=bar |
Matches BigQuery resources where the key equals
foo and the key value equals bar. |
label.foo |
Matches BigQuery resources that have a label whose
key equals foo as a string. |
type=TYPE |
Matches resources of a specific entry type or its type alias. |
projectid:bar |
Matches resources within Google Cloud projects that match
bar as a substring in the ID. |
parent:x |
Matches x as a substring of the hierarchical path of a
resource. The parent path is a fully_qualified_name of
the parent resource. |
orgid=number |
Matches resources within a Google Cloud organization with
the exact ID value of number. |
system=SYSTEM |
Matches resources from a specified system. |
location=LOCATION |
Matches resources in a specified location with an exact name.
For example, BigQuery Omni assets support this qualifier by using the
BigQuery Omni location name.
For example,
|
createtime |
Finds resources that were created within, before, or after a given date or time. For example:
Timestamp format: All timestamps must be in GMT; time zones are not supported. Partial
timestamps, hyphen ( For example:
|
updatetime |
Finds resources that were updated within, before, or after a given date or time. For example:
Timestamp format: All timestamps must be in GMT; time zones are not supported. Partial
timestamps, hyphen ( For example:
|
fully_qualified_name:x |
Matches x as a substring of fully_qualified_name. |
fully_qualified_name=x |
Matches x as fully_qualified_name. |
Aspect search
To search for entries based on their attached aspects, use the following query syntax.
| Qualifier | Description |
|---|---|
aspect:x |
Matches x as a substring of the full path to the aspect
type of an aspect that is attached to the entry, in the format
projectid.location.ASPECT_TYPE_ID |
aspect=x |
Matches x as the full path to the aspect
type of an aspect that is attached to the entry, in the format
projectid.location.ASPECT_TYPE_ID |
aspect:xOPERATORvalue |
Searches for aspect field values. Matches The list of supported operators depends on the type of field in the aspect, as follows:
Only top-level fields of the aspect are searchable. For example, all of the following queries match entries where the value
of the
|
Logical operators
A query can consist of several predicates linked with logical operators AND, OR, or NOT.
- If you don't specify an operator, logical
ANDis implied. For example,foo barreturns resources that match both predicatefooand predicatebar. - Negate a predicate with a
-(hyphen) orNOTprefix. For example,-name:fooreturns resources with names that don't match the predicatefoo.
In keyword-only search, logical operators aren't case-sensitive.
Abbreviated syntax
To use abbreviated syntax in your queries, use | (vertical bar) for OR operators and , (comma) for AND operators.
The abbreviated syntax works for the qualified predicates except for label.
The following examples show how to use abbreviated syntax with keyword-only search.
Search for entries inside one of many projects using the
ORoperatorprojectid:(id1|id2|id3|id4)The same search without using abbreviated syntax looks as follows:
projectid:id1 OR projectid:id2 OR projectid:id3 OR projectid:id4Search for entries with matching column names:
- AND:
column:(name1,name2,name3) - OR:
column:(name1|name2|name3)
- AND:
What's next
- Learn more about metadata management in Knowledge Catalog.
- Learn how to enrich entries and entry links with metadata by using aspects.
- Learn how to manage entries and ingest custom sources.