Menelusuri resource di Knowledge Catalog

Penelusuran Knowledge Catalog (sebelumnya Dataplex Universal Catalog) memungkinkan Anda menemukan resource di seluruh organisasi dengan dukungan penelusuran bahasa alami dengan pencocokan semantik, penelusuran kata kunci, dan sintaksis penelusuran yang ekstensif.

Kasus penggunaan

Daftar berikut menjelaskan kasus penggunaan penelusuran umum, beserta deskripsi dan contoh kueri:

  • Pencarian aset yang ditargetkan: Temukan aset tertentu dengan menelusuri kata kunci yang terkait dengan nama, kolom, atau deskripsi aset.

    Contoh kueri

    • retail_transactions_2026
    • customer_id
    • column:customer_id
  • Penemuan data yang luas: Identifikasi aset yang relevan di seluruh organisasi Anda menggunakan bahasa alami terbuka atau kueri kata kunci.

    Contoh kueri

    • quarterly financial reports
    • ad campaign click through rates tables
    • server health metrics
    • audit logs system=bigquery
  • Pengambilan aset yang tercakup untuk alur kerja: Mencantumkan aset dalam penampung tertentu, seperti project, atau dengan properti tertentu, seperti jenis atau sistem. Pendekatan ini sering digunakan untuk alur kerja terprogram dan berbasis agen.

    Contoh kueri

    • type=table projectid:banking-prod aspect:classification.tier=PII
    • system=spanner projectid:inventory-service (parent=marketing_analytics OR parent=finance_analytics)

Anda memiliki opsi berikut untuk mengakses penelusuran di Knowledge Catalog:

Cara kerjanya

Penelusuran secara otomatis mengindeks semua konteks untuk aset data yang dikelola di Knowledge Catalog. Ini mencakup hal-hal berikut:

  • Metadata yang otomatis di-ingest dari Google Cloud sumber data seperti BigQuery dan Cloud SQL
  • Konteks untuk resource yang Anda masukkan melalui konektor dan integrasi
  • Konteks tambahan yang Anda buat untuk resource (misalnya, merepresentasikan konteks bisnis atau mendeskripsikan semantik data) dan direkam dalam bentuk aspek atau istilah bisnis yang ditautkan.

Saat memproses kueri Anda, penelusuran menerapkan kombinasi pencocokan semantik dan kata kunci. Tabel berikut menjelaskan jenis kueri yang dapat Anda gunakan dengan penelusuran Knowledge Catalog beserta deskripsi dan contoh kueri:

Jenis kueri Penggunaan Contoh
Satu kata kunci Untuk pencocokan persis dan substring di seluruh elemen metadata, seperti nama, deskripsi, dan skema aset. prd_fin_invoices_fct_v02
Kata kunci parsial dan fragmen yang di-tokenisasi Mencocokkan substring di seluruh konten metadata, menemukan resource meskipun dengan istilah yang disingkat, kata yang dipisahkan, atau variasi penamaan. fin transactions 2026 (matches prd_fin_transactions_fy2026_raw)
Kueri bahasa alami Menggunakan pencocokan semantik tanpa memerlukan kecocokan nama atau kolom yang persis. customer churn prediction features
Predikat terstruktur Menggabungkan kueri teks bebas dengan filter predikat eksplisit untuk mempersempit hasil penelusuran. audit logs system=bigquery
Sintaksis yang diperluas Untuk penelusuran yang akurat, dipersempit ke cakupan tertentu. Sintaksis yang diperluas paling sering digunakan dalam kasus penggunaan agentic dan terprogram. Untuk informasi selengkapnya, lihat Sintaksis penelusuran. (system:bigquery OR system:spanner) AND column:credit_card_number aspect:classification.tier=PII -projectid:sandbox-project

Cakupan penelusuran

Hasil penelusuran di Knowledge Catalog mematuhi izin yang Anda miliki atas resource terkait di sistem sumber.

Misalnya, jika Anda memiliki akses baca metadata BigQuery ke suatu objek, objek tersebut akan muncul di hasil penelusuran Knowledge Catalog Anda. Jika Anda memiliki akses ke tabel BigQuery, tetapi tidak ke set data yang berisi tabel tersebut, tabel akan tetap muncul seperti yang diharapkan dalam penelusuran Knowledge Catalog.

Secara default, penelusuran dicakup ke organisasi Anda. Hasil hanya mencakup resource dari organisasi yang sama dengan project yang Anda telusuri.

Hasil penelusuran hanya mencakup resource yang termasuk dalam perimeter Kontrol Layanan VPC yang sama dengan project yang digunakan untuk melakukan penelusuran. Saat menggunakan konsolGoogle Cloud , project ini adalah project yang dipilih di konsol.

Untuk memperluas cakupan hasil penelusuran Anda di luar resource dalam perimeter Kontrol Layanan VPC project Anda, gunakan aturan ingress dan egress Kontrol Layanan VPC. Aturan ini memfasilitasi pertukaran data pribadi dan efisien di seluruh organisasi Anda. Anda dapat mengonfigurasi aturan ingress dan egress menggunakan konsolGoogle Cloud atau melalui file JSON atau YAML. Lihat contoh YAML berikut dan baca dokumentasi Kontrol Layanan VPC untuk menyesuaikan aturan dengan persyaratan spesifik Anda.

egressPolicies:
  - egressFrom:
      identityType: ANY_USER_ACCOUNT
    egressTo:
      # Specify which resources should be present in the search results. In this example,
      # BigQuery.
      operations:
      - methodSelectors:
        - method: '*'
        serviceName: bigquery.googleapis.com
      # Specify project ids under which the search is performed.
      resources:
      - projects/SEARCH_PROJECT_ID
ingressPolicies:
  - ingressFrom:
      identityType: ANY_USER_ACCOUNT
      sources:
      - accessLevel: '*'
    ingressTo:
      # Specify which resources should be present in the search results. In this example,
      # BigQuery.
      operations:
      - methodSelectors:
        - method: '*'
        serviceName: bigquery.googleapis.com
      # Specify project ids to expose in search results.
      resources:
      - projects/INGRESS_PROJECT_ID

Untuk mengetahui informasi selengkapnya tentang peran Identity and Access Management yang perlu Anda gunakan untuk melakukan penelusuran Knowledge Catalog, lihat Peran IAM Knowledge Catalog.

Mengisolasi hasil penelusuran menurut lingkungan menggunakan Kontrol Layanan VPC

Untuk mengisolasi hasil penelusuran Knowledge Catalog di antara lingkungan seperti pengembangan, pengujian, dan produksi, konfigurasi perimeter Kontrol Layanan VPC terpisah untuk setiap lingkungan. Tetapkan project yang berisi aset data dan project yang digunakan untuk melakukan penelusuran ke perimeter lingkungan yang sesuai. Penelusuran yang dilakukan dari project dalam perimeter tertentu hanya akan menampilkan hasil untuk aset yang juga berada dalam perimeter yang sama.

Batasan perolehan dalam penelusuran

Kueri penelusuran Knowledge Catalog tidak menjamin penarikan lengkap, yang berarti bahwa penelusuran mungkin tidak menampilkan hasil yang cocok dengan kueri Anda. Selain itu, hasil yang ditampilkan (dan tidak ditampilkan) mungkin bervariasi jika Anda mengulangi kueri penelusuran.

Untuk mengkueri semua metadata Knowledge Catalog, Anda dapat mengekspor metadata ke Cloud Storage, lalu menguerinya dari BigQuery. Untuk mengetahui informasi selengkapnya, lihat Mengekspor metadata.

Sebelum memulai

Sebelum melakukan penelusuran, pastikan Anda diberi peran yang diperlukan dan telah mengaktifkan API yang diperlukan.

Peran yang diperlukan

Untuk mendapatkan izin yang Anda perlukan untuk menelusuri entri dan mengakses hasil penelusuran di Knowledge Catalog, minta administrator untuk memberi Anda peran IAM berikut:

Untuk mengetahui informasi selengkapnya tentang pemberian peran, lihat Mengelola akses ke project, folder, dan organisasi.

Anda mungkin juga bisa mendapatkan izin yang diperlukan melalui peran khusus atau peran bawaan lainnya.

Izin pada hasil penelusuran diperiksa secara terpisah dari project yang dipilih.

Hasil penelusuran di Knowledge Catalog diberi cakupan sesuai dengan peran Anda. Untuk menelusuri aset di Knowledge Catalog, Anda harus memiliki izin untuk mengakses resource yang sesuai di sistem sumber. Untuk mengetahui informasi selengkapnya, lihat bagian Cakupan penelusuran dalam dokumen ini.

Misalnya, untuk menelusuri set data, tabel, tampilan, dan model BigQuery, Anda memerlukan izin masing-masing untuk entri tersebut. Untuk mengetahui informasi selengkapnya, lihat Izin BigQuery.

Daftar berikut menjelaskan izin minimum yang diperlukan:

  • Untuk menelusuri tabel, Anda memerlukan izin bigquery.tables.get untuk tabel tersebut.
  • Untuk menelusuri set data, Anda memerlukan izin bigquery.datasets.get untuk set data tersebut.

Sebagai contoh lain, untuk menelusuri instance, database, skema, tabel, dan tampilan Cloud SQL, Anda memerlukan izin masing-masing pada entri tersebut. Untuk mengetahui informasi selengkapnya, lihat Peran dan izin Cloud SQL.

Mengaktifkan API

Mengaktifkan Dataplex API.

Peran yang diperlukan untuk mengaktifkan API

Untuk mengaktifkan API, Anda memerlukan izin serviceusage.services.enable. Jika Anda membuat project, kemungkinan Anda sudah memiliki izin ini melalui peran Pemilik (roles/owner). Jika tidak, Anda bisa mendapatkan izin ini melalui peran Admin Penggunaan Layanan (roles/serviceusage.serviceUsageAdmin). Pelajari cara memberikan peran.

Mengaktifkan API

Telusuri referensi

Konsol

Untuk menelusuri resource, ikuti langkah-langkah berikut:

  1. Di konsol Google Cloud , buka halaman Penelusuran Knowledge Catalog.

    Buka Penelusuran

  2. Jika Anda melihat perintah tombol Coba penelusuran bahasa alami, klik tombol tersebut. Secara default, penelusuran bahasa alami dipilih.

  3. Di kolom Find resources across projects with natural language, masukkan kueri Anda, lalu klik Enter.

  4. Untuk mempersempit penelusuran, klik Filter. Untuk mengetahui daftar filter yang tersedia, lihat Filter.

  5. Untuk melihat informasi selengkapnya tentang resource yang ditelusuri, di hasil penelusuran, klik nama resource. Tindakan ini akan membuka halaman detail entri.

Google Cloud CLI

Untuk menelusuri resource, gunakan perintah gcloud dataplex entries search:

gcloud dataplex entries search 'foo' \
  --project=PROJECT_ID \
  [--semantic-search]

Ganti PROJECT_ID dengan ID project Google Cloud .

C#

C#

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan C# di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog C# API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

using Google.Api.Gax;
using Google.Api.Gax.ResourceNames;
using Google.Cloud.Dataplex.V1;
using System;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for SearchEntries</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void SearchEntriesRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        SearchEntriesRequest request = new SearchEntriesRequest
        {
            LocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            Query = "",
            OrderBy = "",
            Scope = "",
            SemanticSearch = false,
        };
        // Make the request
        PagedEnumerable<SearchEntriesResponse, SearchEntriesResult> response = catalogServiceClient.SearchEntries(request);

        // Iterate over all response items, lazily performing RPCs as required
        foreach (SearchEntriesResult item in response)
        {
            // Do something with each item
            Console.WriteLine(item);
        }

        // Or iterate over pages (of server-defined size), performing one RPC per page
        foreach (SearchEntriesResponse page in response.AsRawResponses())
        {
            // Do something with each page of items
            Console.WriteLine("A page of results:");
            foreach (SearchEntriesResult item in page)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
        }

        // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
        int pageSize = 10;
        Page<SearchEntriesResult> singlePage = response.ReadPage(pageSize);
        // Do something with the page of items
        Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
        foreach (SearchEntriesResult item in singlePage)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
        // Store the pageToken, for when the next page is required.
        string nextPageToken = singlePage.NextPageToken;
    }
}

Go

Go

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Go di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Go API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.


//go:build examples

package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.SearchEntriesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#SearchEntriesRequest.
	}
	it := c.SearchEntries(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*dataplexpb.SearchEntriesResponse)
	}
}

Java

Java

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Java di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Java API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.LocationName;
import com.google.cloud.dataplex.v1.SearchEntriesRequest;
import com.google.cloud.dataplex.v1.SearchEntriesResult;

public class SyncSearchEntries {

  public static void main(String[] args) throws Exception {
    syncSearchEntries();
  }

  public static void syncSearchEntries() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
      SearchEntriesRequest request =
          SearchEntriesRequest.newBuilder()
              .setName(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setQuery("query107944136")
              .setPageSize(883849137)
              .setPageToken("pageToken873572522")
              .setOrderBy("orderBy-1207110587")
              .setScope("scope109264468")
              .setSemanticSearch(true)
              .build();
      for (SearchEntriesResult element : catalogServiceClient.searchEntries(request).iterateAll()) {
        // doThingsWith(element);
      }
    }
  }
}

Node.js

Node.js

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Node.js di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Node.js API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The project to which the request should be attributed in the
 *  following form: `projects/{project}/locations/global`.
 */
// const name = 'abc123'
/**
 *  Required. The query against which entries in scope should be matched.
 *  The query syntax is defined in Search syntax for Dataplex Universal
 *  Catalog (https://cloud.google.com/dataplex/docs/search-syntax).
 */
// const query = 'abc123'
/**
 *  Optional. Number of results in the search page. If <=0, then defaults
 *  to 10. Max limit for page_size is 1000. Throws an invalid argument for
 *  page_size > 1000.
 */
// const pageSize = 1234
/**
 *  Optional. Page token received from a previous `SearchEntries` call. Provide
 *  this to retrieve the subsequent page.
 */
// const pageToken = 'abc123'
/**
 *  Optional. Specifies the ordering of results.
 *  Supported values are:
 *  * `relevance`
 *  * `last_modified_timestamp`
 *  * `last_modified_timestamp asc`
 */
// const orderBy = 'abc123'
/**
 *  Optional. The scope under which the search should be operating. It must
 *  either be `organizations/<org_id>` or `projects/<project_ref>`. If it is
 *  unspecified, it defaults to the organization where the project provided in
 *  `name` is located.
 */
// const scope = 'abc123'
/**
 *  Optional. Specifies whether the search should understand the meaning and
 *  intent behind the query, rather than just matching keywords.
 */
// const semanticSearch = true

// Imports the Dataplex library
const {CatalogServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new CatalogServiceClient();

async function callSearchEntries() {
  // Construct request
  const request = {
    name,
    query,
  };

  // Run request
  const iterable = dataplexClient.searchEntriesAsync(request);
  for await (const response of iterable) {
      console.log(response);
  }
}

callSearchEntries();

PHP

PHP

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan PHP di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog PHP API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dataplex\V1\Client\CatalogServiceClient;
use Google\Cloud\Dataplex\V1\SearchEntriesRequest;
use Google\Cloud\Dataplex\V1\SearchEntriesResult;

/**
 * Searches for Entries matching the given query and scope.
 *
 * @param string $formattedName The project to which the request should be attributed in the
 *                              following form: `projects/{project}/locations/global`. Please see
 *                              {@see CatalogServiceClient::locationName()} for help formatting this field.
 * @param string $query         The query against which entries in scope should be matched.
 *                              The query syntax is defined in [Search syntax for Dataplex Universal
 *                              Catalog](https://cloud.google.com/dataplex/docs/search-syntax).
 */
function search_entries_sample(string $formattedName, string $query): void
{
    // Create a client.
    $catalogServiceClient = new CatalogServiceClient();

    // Prepare the request message.
    $request = (new SearchEntriesRequest())
        ->setName($formattedName)
        ->setQuery($query);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $catalogServiceClient->searchEntries($request);

        /** @var SearchEntriesResult $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = CatalogServiceClient::locationName('[PROJECT]', '[LOCATION]');
    $query = '[QUERY]';

    search_entries_sample($formattedName, $query);
}

Python

Python

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Python di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Python API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_search_entries():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.SearchEntriesRequest(
        name="name_value",
        query="query_value",
    )

    # Make the request
    page_result = client.search_entries(request=request)

    # Handle the response
    for response in page_result:
        print(response)

Ruby

Ruby

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Ruby di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Ruby API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

require "google/cloud/dataplex/v1"

##
# Snippet for the search_entries call in the CatalogService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::CatalogService::Client#search_entries.
#
def search_entries
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::CatalogService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::SearchEntriesRequest.new

  # Call the search_entries method.
  result = client.search_entries request

  # The returned object is of type Gapic::PagedEnumerable. You can iterate
  # over elements, and API calls will be issued to fetch pages as needed.
  result.each do |item|
    # Each element is of type ::Google::Cloud::Dataplex::V1::SearchEntriesResult.
    p item
  end
end

REST

Untuk menelusuri resource, gunakan metode searchEntries dengan parameter semanticSearch yang ditetapkan ke true.

POST https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION:searchEntries?query=foo&semanticSearch=true

Ganti kode berikut:

  • PROJECT_ID: ID Google Cloud project Anda
  • LOCATION: region tempat project berada (misalnya, us-central1)

Filter

Filter memungkinkan Anda mempersempit hasil penelusuran.

Jika Anda memberikan filter di beberapa bagian, filter tersebut akan dievaluasi menggunakan operator logika AND. Hasil penelusuran berisi referensi yang cocok dengan setidaknya satu kondisi dari setiap bagian yang dipilih. Misalnya, jika Anda memilih sistem BigQuery dan jenis resource set data, hasil penelusuran akan mencakup set data BigQuery, tetapi tidak mencakup set data Vertex AI.

Jika Anda memilih beberapa filter dalam satu bagian, filter tersebut dievaluasi menggunakan operator logika OR. Misalnya, jika Anda memilih jenis resource set data dan jenis resource tabel, hasil penelusuran akan mencakup set data dan tabel.

Filter berikut tersedia:

  • Cakupan: telusuri di seluruh organisasi (default), project saat ini, atau hanya untuk resource berbintang. Untuk mengetahui informasi selengkapnya, lihat bagian Cakupan penelusuran dalam dokumen ini.
  • Sistem: Google Cloud layanan tempat resource berada, seperti BigQuery. Sistem Knowledge Catalog berisi grup entri.
  • Project: project yang akan ditelusuri.
  • Jenis: jenis resource, seperti koneksi BigQuery, bucket Cloud Storage, atau database. Bergantung pada jenis resource, Anda juga dapat memfilter menurut subjenis, seperti jenis koneksi atau dialek SQL.
  • Pilih lokasi: lokasi yang akan ditelusuri.
  • Pilih set data: hasil penelusuran dibatasi pada resource BigQuery yang termasuk dalam set data BigQuery yang dipilih. Di kolom Ketik untuk memfilter, masukkan nama set data.
  • Jenis aspek: Jenis aspek Knowledge Catalog yang terkait dengan resource yang Anda cari. Untuk memfilter menurut nilai aspek, klik Filter menurut nilai jenis aspek, lalu pilih nilai.

Melihat detail aset yang ditampilkan oleh penelusuran

Konsol

Gunakan penelusuran Knowledge Catalog untuk melihat detail aset.

  1. Telusuri aset di Knowledge Catalog.

  2. Di hasil penelusuran, klik aset yang detailnya ingin Anda lihat.

    Halaman detail entri akan terbuka. Halaman ini mencakup bagian-bagian berikut:

    • Detail entri: mencakup informasi seperti jenis entri, sistem, platform, nama yang memenuhi syarat sepenuhnya, waktu pembuatan, waktu modifikasi terakhir, deskripsi, dan pengelola.
    • Ringkasan: ringkasan entri, jika tersedia.
    • Aspek: aspek wajib dan opsional yang ditentukan untuk entri. Untuk mengetahui informasi selengkapnya, lihat Kategori aspek.

gcloud

Perintah gcloud dataplex entries lookup:

gcloud dataplex entries lookup ENTRY_ID \
  --entry-group=ENTRY_GROUP_ID \
  --location=LOCATION \
  --project=PROJECT_ID

Ganti kode berikut:

  • ENTRY_ID: ID entri
  • ENTRY_GROUP_ID: ID grup entri
  • LOCATION: region tempat project berada
  • PROJECT_ID: ID Google Cloud project

C#

C#

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan C# di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog C# API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

using Google.Cloud.Dataplex.V1;

public sealed partial class GeneratedCatalogServiceClientSnippets
{
    /// <summary>Snippet for LookupEntry</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void LookupEntryRequestObject()
    {
        // Create client
        CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
        // Initialize request argument(s)
        LookupEntryRequest request = new LookupEntryRequest
        {
            Name = "",
            View = EntryView.Unspecified,
            AspectTypes = { "", },
            Paths = { "", },
            EntryAsEntryName = EntryName.FromProjectLocationEntryGroupEntry("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]", "[ENTRY]"),
        };
        // Make the request
        Entry response = catalogServiceClient.LookupEntry(request);
    }
}

Go

Go

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Go di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Go API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.


//go:build examples

package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewCatalogClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.LookupEntryRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#LookupEntryRequest.
	}
	resp, err := c.LookupEntry(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Java di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Java API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

import com.google.cloud.dataplex.v1.CatalogServiceClient;
import com.google.cloud.dataplex.v1.Entry;
import com.google.cloud.dataplex.v1.EntryName;
import com.google.cloud.dataplex.v1.EntryView;
import com.google.cloud.dataplex.v1.LookupEntryRequest;
import java.util.ArrayList;

public class SyncLookupEntry {

  public static void main(String[] args) throws Exception {
    syncLookupEntry();
  }

  public static void syncLookupEntry() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CatalogServiceClient catalogServiceClient = CatalogServiceClient.create()) {
      LookupEntryRequest request =
          LookupEntryRequest.newBuilder()
              .setName("name3373707")
              .setView(EntryView.forNumber(0))
              .addAllAspectTypes(new ArrayList<String>())
              .addAllPaths(new ArrayList<String>())
              .setEntry(
                  EntryName.of("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]", "[ENTRY]").toString())
              .build();
      Entry response = catalogServiceClient.lookupEntry(request);
    }
  }
}

Node.js

Node.js

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Node.js di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Node.js API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The project to which the request should be attributed in the
 *  following form: `projects/{project}/locations/{location}`.
 */
// const name = 'abc123'
/**
 *  Optional. View to control which parts of an entry the service should
 *  return.
 *  **Please check the limitations on returned aspects in the Entry view
 *  documentation. Amount of returned aspects depends on the selected Entry
 *  View.**
 */
// const view = {}
/**
 *  Optional. Limits the aspects returned to the provided aspect types.
 *  It only works for CUSTOM view.
 */
// const aspectTypes = ['abc','def']
/**
 *  Optional. Limits the aspects returned to those associated with the provided
 *  paths within the Entry. It only works for CUSTOM view.
 */
// const paths = ['abc','def']
/**
 *  Required. The resource name of the Entry:
 *  `projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}`.
 */
// const entry = 'abc123'

// Imports the Dataplex library
const {CatalogServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new CatalogServiceClient();

async function callLookupEntry() {
  // Construct request
  const request = {
    name,
    entry,
  };

  // Run request
  const response = await dataplexClient.lookupEntry(request);
  console.log(response);
}

callLookupEntry();

PHP

PHP

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan PHP di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog PHP API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

use Google\ApiCore\ApiException;
use Google\Cloud\Dataplex\V1\Client\CatalogServiceClient;
use Google\Cloud\Dataplex\V1\Entry;
use Google\Cloud\Dataplex\V1\LookupEntryRequest;

/**
 * Looks up an entry by name using the permission on the source system.
 *
 * @param string $name           The project to which the request should be attributed in the
 *                               following form: `projects/{project}/locations/{location}`.
 * @param string $formattedEntry The resource name of the Entry:
 *                               `projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}`. Please see
 *                               {@see CatalogServiceClient::entryName()} for help formatting this field.
 */
function lookup_entry_sample(string $name, string $formattedEntry): void
{
    // Create a client.
    $catalogServiceClient = new CatalogServiceClient();

    // Prepare the request message.
    $request = (new LookupEntryRequest())
        ->setName($name)
        ->setEntry($formattedEntry);

    // Call the API and handle any network failures.
    try {
        /** @var Entry $response */
        $response = $catalogServiceClient->lookupEntry($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';
    $formattedEntry = CatalogServiceClient::entryName(
        '[PROJECT]',
        '[LOCATION]',
        '[ENTRY_GROUP]',
        '[ENTRY]'
    );

    lookup_entry_sample($name, $formattedEntry);
}

Python

Python

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Python di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Python API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_lookup_entry():
    # Create a client
    client = dataplex_v1.CatalogServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.LookupEntryRequest(
        name="name_value",
        entry="entry_value",
    )

    # Make the request
    response = client.lookup_entry(request=request)

    # Handle the response
    print(response)

Ruby

Ruby

Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Ruby di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Ruby API.

Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

require "google/cloud/dataplex/v1"

##
# Snippet for the lookup_entry call in the CatalogService service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::CatalogService::Client#lookup_entry.
#
def lookup_entry
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::CatalogService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::LookupEntryRequest.new

  # Call the lookup_entry method.
  result = client.lookup_entry request

  # The returned object is of type Google::Cloud::Dataplex::V1::Entry.
  p result
end

REST

Untuk melihat detail aset, gunakan metode lookupEntry.

Knowledge Catalog menyediakan mode penelusuran khusus kata kunci untuk kompatibilitas mundur, dengan mode penelusuran standar yang mendukung pencocokan semantik dan kata kunci.

Sebaiknya gunakan mode penelusuran standar, kecuali jika penelusuran khusus kata kunci diperlukan untuk kompatibilitas mundur.

Filter penelusuran khusus kata kunci

Untuk penelusuran kata kunci, filter dikelompokkan ke dalam bagian berikut:

  • Sistem seperti BigQuery, Cloud SQL, dan lainnya. Sistem Knowledge Catalog berisi entri kustom.
  • Aspek mencantumkan semua aspek yang tersedia untuk Anda. Untuk memfilter menurut nilai aspek, klik Filter menurut nilai aspek, lalu pilih nilai.
  • Project mencantumkan semua project yang tersedia untuk Anda.
  • Alias jenis adalah jenis data yang terkait dengan jenis entri. Jenis entri mungkin memiliki nama projects/test-project/locations/us/entryTypes/my-entry-type, tetapi Anda dapat menelusurinya menggunakan alias jenis TABLE atau DATABASE. Anda dapat menetapkan satu atau beberapa alias jenis saat membuat atau memperbarui jenis entri.
  • Set data berasal dari BigQuery.

Filter Sistem, Alias jenis, Project, dan Set data ditampilkan bergantung pada kueri saat ini di kolom Penelusuran.

Untuk menggunakan penelusuran khusus kata kunci, lakukan hal berikut:

Konsol

  1. Jika Anda berada dalam mode penelusuran bahasa alami, klik Kembali ke penelusuran kata kunci.
  2. Di kolom Find resources across projects, masukkan kueri Anda.
  3. Untuk menyaring penelusuran, gunakan panel Filter.

    Untuk daftar filter yang tersedia, lihat Filter penelusuran kata kunci.

    Anda dapat menambahkan filter berikut secara manual:

    • Tambahkan filter project: di Project, klik Tambahkan project. Cari project tertentu, pilih project, lalu klik Buka.
    • Menambahkan filter jenis aspek: di Aspek, klik menu Tambahkan jenis aspek lainnya. Telusuri template tertentu, pilih template tersebut, lalu klik OK.
  4. Opsional: Selain aset yang tersedia untuk Anda, Anda dapat menelusuri sumber daya yang tersedia untuk publik di Google Cloud dengan memilih Sertakan set data publik.

    Gunakan tips berikut untuk membuat kueri penelusuran:

    • Sertakan ekspresi penelusuran Anda dalam tanda kutip jika berisi spasi. Contoh, "search terms"
    • Awali kata kunci dengan NOT untuk mencocokkan negasi logis filter keyword:term. Anda juga dapat menggunakan operator Boolean AND dan OR untuk menggabungkan ekspresi penelusuran. Operator AND, OR, dan NOT tidak peka huruf besar/kecil.

    Misalnya, NOT column:term mencantumkan semua kolom kecuali yang cocok dengan istilah yang ditentukan. Untuk melihat daftar kata kunci dan istilah lain yang dapat Anda gunakan dalam ekspresi penelusuran Knowledge Catalog, lihat Sintaksis penelusuran.

gcloud

Untuk menelusuri resource menggunakan mode penelusuran hanya kata kunci, gunakan perintah gcloud dataplex entries search dan hapus flag --semantic-search, atau gunakan flag --no-semantic-search.

REST

Untuk menelusuri resource menggunakan mode penelusuran hanya kata kunci, gunakan metode searchEntries dengan parameter kueri semanticSearch yang ditetapkan ke false.

Batasan

Penelusuran memiliki batasan berikut:

  • Sumber daya publik berada di luar cakupan penelusuran bahasa alami.
  • Aspek yang dilampirkan ke link entri berada di luar cakupan penelusuran natural language.

Langkah berikutnya