חיפוש משאבים ב-Knowledge Catalog

חיפוש ב-Knowledge Catalog (לשעבר Dataplex Universal Catalog) מאפשר לכם לגלות משאבים בארגון שלכם. החיפוש תומך בחיפוש בשפה טבעית עם התאמה סמנטית, בחיפוש לפי מילות מפתח ובחיפוש באמצעות תחביר מורחב.

תרחישים לדוגמה

ברשימה הבאה מתוארים תרחישי שימוש נפוצים בחיפוש, יחד עם תיאורים ודוגמאות לשאילתות:

  • חיפוש ממוקד של נכס: אפשר לחפש מילות מפתח שקשורות לשם הנכס, לעמודות או לתיאור שלו כדי למצוא נכס ספציפי.

    שאילתות לדוגמה

    • retail_transactions_2026
    • customer_id
    • column:customer_id
  • גילוי נתונים רחב: זיהוי נכסים רלוונטיים בארגון באמצעות שאילתות בשפה טבעית או שאילתות מילות מפתח.

    שאילתות לדוגמה

    • quarterly financial reports
    • ad campaign click through rates tables
    • server health metrics
    • audit logs system=bigquery
  • אחזור נכסים בהיקף מוגדר לזרימות עבודה: אפשר למנות נכסים בתוך מאגר ספציפי, כמו פרויקט, או עם מאפיינים ספציפיים, כמו סוג או מערכת. הגישה הזו נפוצה בתהליכי עבודה מבוססי תוכנה ומבוססי סוכנים.

    שאילתות לדוגמה

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

יש כמה דרכים לגשת לחיפוש ב-Knowledge Catalog:

איך זה עובד

החיפוש מאנדקס באופן אוטומטי את כל ההקשר של נכסי הנתונים שמתעדכנים ב-Knowledge Catalog. הדוגמאות הבאות ממחישות את המצב הזה:

  • מטא-נתונים שמיובאים אוטומטית ממקורות נתונים Google Cloud כמו BigQuery ו-Cloud SQL
  • הקשר למשאבים שאתם מטמיעים באמצעות מחברים ושילובים
  • הקשר נוסף שאתם יוצרים למשאבים (לדוגמה, הקשר עסקי או תיאור של הסמנטיקה של הנתונים) ומתועד בצורה של היבטים או מונחים עסקיים מקושרים.

במהלך עיבוד השאילתה, מערכת החיפוש משתמשת בשילוב של התאמה סמנטית והתאמה למילות מפתח. בטבלה הבאה מפורטים סוגי השאילתות שאפשר להשתמש בהם בחיפוש ב-Knowledge Catalog, יחד עם תיאורים ודוגמאות לשאילתות:

סוג השאילתה Usage דוגמאות
מילת מפתח יחידה התאמה מדויקת והתאמה של מחרוזת משנה בין רכיבי מטא-נתונים, כמו שם הנכס, התיאור והסכימה. prd_fin_invoices_fct_v02
מילות מפתח חלקיות וקטעי טוקנים התאמה של מחרוזות משנה בתוכן של מטא-נתונים, חיפוש משאבים גם עם מונחים מקוצרים, מילים מופרדות או וריאציות של שמות. fin transactions 2026 (התאמות prd_fin_transactions_fy2026_raw)
שאילתות בשפה טבעית השימוש בהתאמה סמנטית לא מחייב התאמות מדויקות של שמות או עמודות. customer churn prediction features
פסקי דין מובְנים משלב שאילתות טקסט חופשי עם מסנני פרדיקטים מפורשים כדי לצמצם את תוצאות החיפוש. audit logs system=bigquery
תחביר מורחב לחיפוש מדויק, שמצומצם להיקף ספציפי. תחביר מורחב משמש לרוב בתרחישי שימוש אקטיביים ותכנותיים. מידע נוסף זמין במאמר בנושא תחביר החיפוש. (system:bigquery OR system:spanner) AND column:credit_card_number aspect:classification.tier=PII -projectid:sandbox-project

טווח החיפוש

תוצאות החיפוש ב-Knowledge Catalog מכבדות את ההרשאות שיש לכם לגבי המשאבים התואמים במערכות המקור.

לדוגמה, אם יש לכם גישת קריאה למטא-נתונים של BigQuery לאובייקט מסוים, האובייקט הזה יופיע בתוצאות החיפוש של Knowledge Catalog. אם יש לכם גישה לטבלה ב-BigQuery אבל לא למערך הנתונים שמכיל את הטבלה הזו, הטבלה עדיין תופיע בחיפוש ב-Knowledge Catalog כמו שציפיתם.

כברירת מחדל, החיפוש מוגבל לארגון שלכם. התוצאות כוללות רק משאבים מאותו ארגון של הפרויקט שבו אתם מחפשים.

תוצאות החיפוש כוללות רק את המשאבים ששייכים לאותו היקף של VPC Service Controls כמו הפרויקט שבו מתבצע החיפוש. כשמשתמשים במסוףGoogle Cloud , זהו הפרויקט שנבחר במסוף.

כדי להרחיב את היקף תוצאות החיפוש מעבר למשאבים ב-service perimeter של VPC Service Controls בפרויקט, אפשר להשתמש בכללי תעבורת נתונים נכנסת (ingress) ויוצאת (egress) של VPC Service Controls. הכללים האלה מאפשרים להחליף נתונים באופן פרטי ויעיל בארגון. אפשר להגדיר כללי תעבורת נתונים נכנסת (ingress) ותעבורת נתונים יוצאת (egress) באמצעות מסוףGoogle Cloud או באמצעות קובצי JSON או YAML. אפשר להיעזר בדוגמה הבאה של YAML ובמסמכי התיעוד של VPC Service Controls כדי להתאים את הכלל לדרישות הספציפיות שלכם.

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

במאמר תפקידי IAM ב-Knowledge Catalog מוסבר אילו תפקידים בניהול הזהויות והרשאות הגישה (IAM) צריך להשתמש כדי לחפש ב-Knowledge Catalog.

בידוד תוצאות החיפוש לפי סביבה באמצעות VPC Service Controls

כדי לבודד את תוצאות החיפוש ב-Knowledge Catalog בין סביבות כמו פיתוח, בדיקה וייצור, צריך להגדיר היקפים נפרדים של VPC Service Controls לכל סביבה. מקצים את הפרויקטים שמכילים את נכסי הנתונים ואת הפרויקטים שמשמשים לביצוע חיפושים לגבולות הגזרה של הסביבה המתאימה. חיפושים שמבוצעים מפרויקט בתוך היקף מסוים יחזירו רק תוצאות של נכסים שנמצאים גם הם באותו היקף.

מגבלות על ביטול שליחה בחיפוש

שאילתות חיפוש ב-Knowledge Catalog לא מבטיחות היזכרות מלאה, כלומר יכול להיות שהחיפוש לא יחזיר תוצאות שתואמות לשאילתה. בנוסף, אם תחזרו על שאילתות חיפוש, יכול להיות שתקבלו תוצאות שונות (או שלא תקבלו תוצאות בכלל).

כדי לשלוח שאילתה לכל המטא-נתונים של Knowledge Catalog, אפשר לייצא את המטא-נתונים ל-Cloud Storage ואז לשלוח שאילתה מ-BigQuery. מידע נוסף זמין במאמר בנושא ייצוא מטא-נתונים.

לפני שמתחילים

לפני שמבצעים חיפוש, צריך לוודא שהוקצו לכם התפקידים הנדרשים ושהפעלתם את ה-API הדרוש.

התפקידים הנדרשים

כדי לקבל את ההרשאות שדרושות בשביל לחפש רשומות ולגשת לתוצאות החיפוש ב-Knowledge Catalog, אתם צריכים לבקש מהאדמין לתת לכם את התפקידים הבאים ב-IAM:

להסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.

יכול להיות שאפשר לקבל את ההרשאות הנדרשות גם באמצעות תפקידים בהתאמה אישית או תפקידים מוגדרים מראש.

ההרשאות בתוצאות החיפוש נבדקות בנפרד מהפרויקט שנבחר.

תוצאות החיפוש ב-Knowledge Catalog מוגבלות בהתאם לתפקיד שלכם. כדי לחפש נכס ב-Knowledge Catalog, צריכות להיות לכם הרשאות גישה למשאב המתאים במערכת המקור. מידע נוסף מופיע בקטע היקף החיפוש במאמר הזה.

לדוגמה, כדי לחפש מערכי נתונים, טבלאות, תצוגות ומודלים של BigQuery, אתם צריכים את ההרשאות המתאימות לערכים האלה. מידע נוסף זמין במאמר הרשאות ב-BigQuery.

הרשימה הבאה מתארת את ההרשאות המינימליות הנדרשות:

  • כדי לחפש טבלה, צריך הרשאה bigquery.tables.get לטבלה הזו.
  • כדי לחפש מערך נתונים, צריך הרשאת bigquery.datasets.get למערך הנתונים הזה.

דוגמה נוספת: כדי לחפש מכונות, מסדי נתונים, סכימות, טבלאות ותצוגות ב-Cloud SQL, צריך הרשאות מתאימות לערכים האלה. מידע נוסף זמין במאמר תפקידים והרשאות ב-Cloud SQL.

הפעלת ה-API

מפעילים את Dataplex API.

תפקידים שנדרשים להפעלת ממשקי API

כדי להפעיל ממשקי API, נדרשת ההרשאה serviceusage.services.enable. אם יצרתם את הפרויקט, סביר להניח שכבר יש לכם את ההרשאה הזו דרך התפקיד 'בעלים' (roles/owner). אחרת, תוכלו לקבל את ההרשאה הזו דרך התפקיד 'אדמין בממשק 'שימוש בשירות'' (roles/serviceusage.serviceUsageAdmin). איך מקצים תפקידים

להפעלת ה-API

חיפוש מקורות מידע

המסוף

כדי לחפש משאבים, פועלים לפי השלבים הבאים:

  1. נכנסים לדף Search בקטלוג הידע במסוף Google Cloud .

    מעבר אל חיפוש

  2. אם מופיעה ההנחיה רוצה לנסות חיפוש בשפה טבעית?, לוחצים עליה. כברירת מחדל, האפשרות 'חיפוש בשפה טבעית' מסומנת.

  3. בשדה חיפוש משאבים בכל הפרויקטים באמצעות שפה טבעית, מזינים את השאילתה ולוחצים על Enter.

  4. כדי לצמצם את החיפוש, לוחצים על מסננים. רשימת המסננים הזמינים מופיעה במאמר מסננים.

  5. כדי לראות מידע נוסף על המשאב שחיפשתם, לוחצים על שם המשאב בתוצאות החיפוש. ייפתח דף הפרטים של הרשומה.

Google Cloud CLI

כדי לחפש משאבים, משתמשים בפקודה gcloud dataplex entries search:

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

מחליפים את PROJECT_ID במזהה הפרויקט. Google Cloud

C#‎

C#

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי C#ההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog C# API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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ההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog Go API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.


//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

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי Javaההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog Java API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי Node.jsההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog Node.js API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

/**
 * 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

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי PHPההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog PHP API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי Pythonההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog Python API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

# 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

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי Rubyההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog Ruby API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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

כדי לחפש משאבים, משתמשים ב-method ‏searchEntries עם הפרמטר semanticSearch שמוגדר ל-true.

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

מחליפים את מה שכתוב בשדות הבאים:

  • PROJECT_ID: מזהה הפרויקט ב- Google Cloud
  • LOCATION: האזור שבו הפרויקט קיים (לדוגמה, us-central1)

מסננים

בעזרת מסננים אפשר לצמצם את תוצאות החיפוש.

כשמספקים מסננים בכמה קטעים, המערכת מעריכה אותם באמצעות האופרטור הלוגי AND. תוצאות החיפוש מכילות מקורות מידע שתואמים לפחות לתנאי אחד מכל אחד מהקטעים שנבחרו. לדוגמה, אם בוחרים במערכת BigQuery ובסוג המשאב dataset, תוצאות החיפוש יכללו מערכי נתונים של BigQuery אבל לא מערכי נתונים של Vertex AI.

אם בוחרים כמה מסננים באותו קטע, המערכת מבצעת הערכה שלהם באמצעות האופרטור הלוגי OR. לדוגמה, אם בוחרים את סוג המשאב dataset ואת סוג המשאב table, תוצאות החיפוש יכללו גם מערכי נתונים וגם טבלאות.

אלה המסננים שזמינים:

  • Scope: חיפוש בכל הארגון (ברירת מחדל), בפרויקט הנוכחי או רק במשאבים המסומנים בכוכב. מידע נוסף מופיע בקטע היקף החיפוש במסמך הזה.
  • Systems: Google Cloud השירות שאליו משתייך המשאב, כמו BigQuery. מערכת Knowledge Catalog מכילה קבוצות של רשומות.
  • Projects: הפרויקטים שבהם יתבצע החיפוש.
  • סוג: סוג המשאב, כמו חיבור ל-BigQuery, קטגוריה של Cloud Storage או מסד נתונים. בהתאם לסוג המשאב, אפשר גם לסנן לפי סוג משנה, כמו סוג החיבור או ניב SQL.
  • בחירת מיקומים: המיקומים שבהם יתבצע החיפוש.
  • בחירת מערכי נתונים: תוצאות החיפוש מוגבלות למשאבי BigQuery ששייכים למערכי הנתונים שנבחרו ב-BigQuery. בשדה Type to filter (הקלדה לסינון), מזינים את השם של מערך הנתונים.
  • סוגי היבטים: סוגי ההיבטים ב-Knowledge Catalog שמשויכים למשאב שאתם מחפשים. כדי לסנן לפי ערכי מאפיינים, לוחצים על סינון לפי ערכי סוג מאפיין ואז בוחרים את הערכים.

הצגת פרטים של נכס שהוחזר על ידי חיפוש

המסוף

משתמשים בחיפוש ב-Knowledge Catalog כדי לראות את הפרטים של נכס.

  1. חיפוש נכס ב-Knowledge Catalog.

  2. בתוצאות החיפוש, לוחצים על הנכס שרוצים לראות את הפרטים שלו.

    ייפתח דף הפרטים של הרשומה. הדף כולל את הקטעים הבאים:

    • פרטי הרשומה: כוללים מידע כמו סוג הרשומה, המערכת, הפלטפורמה, השם המוגדר במלואו, זמן היצירה, זמן השינוי האחרון, התיאור והאחראים.
    • סקירה כללית: סקירה כללית של הערך, אם היא זמינה.
    • מאפיינים: המאפיינים הנדרשים והאופציונליים שהוגדרו לרשומה. מידע נוסף זמין במאמר בנושא קטגוריות של היבטים.

gcloud

פקודת gcloud dataplex entries lookup:

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

מחליפים את מה שכתוב בשדות הבאים:

  • ENTRY_ID: המזהה של הרשומה
  • ENTRY_GROUP_ID: המזהה של קבוצת הרשומות
  • LOCATION: האזור שבו הפרויקט קיים
  • PROJECT_ID: המזהה של Google Cloud הפרויקט

C#‎

C#

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי C#ההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog C# API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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ההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog Go API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.


//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

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי Javaההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog Java API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי Node.jsההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog Node.js API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

/**
 * 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

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי PHPההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog PHP API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי Pythonההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog Python API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

# 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

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי Rubyההוראות להגדרה במאמר מדריך למתחילים לעבודה עם Knowledge Catalog באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של Knowledge Catalog Ruby API.

כדי לבצע אימות לקטלוג הידע, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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

כדי לראות את פרטי הנכס, משתמשים בשיטה lookupEntry.

Knowledge Catalog מספק מצב חיפוש של מילות מפתח בלבד לצורך תאימות לדורות קודמים, ומצב החיפוש הרגיל תומך בהתאמה סמנטית ובהתאמה למילות מפתח.

מומלץ להשתמש במצב חיפוש רגיל, אלא אם נדרש חיפוש של מילות מפתח בלבד לצורך תאימות לאחור.

מסנני חיפוש של מילות מפתח בלבד

בחיפוש מילות מפתח, המסננים מחולקים לקטעים הבאים:

  • מערכות כמו BigQuery,‏ Cloud SQL ועוד. מערכת Knowledge Catalog מכילה רשומות מותאמות אישית.
  • היבטים: רשימה של כל ההיבטים שזמינים לכם. כדי לסנן לפי ערכי היבטים, לוחצים על סינון לפי ערכי היבטים ואז בוחרים את הערכים.
  • פרויקט: רשימה של כל הפרויקטים שזמינים לכם.
  • כינויי סוגים הם סוגי נתונים שמשויכים לסוג רשומה. לסוג רשומה יכול להיות השם projects/test-project/locations/us/entryTypes/my-entry-type, אבל אפשר לחפש אותו באמצעות הכינויים שלו TABLE או DATABASE. אפשר להגדיר כינוי אחד או יותר לסוג כשיוצרים או מעדכנים סוג רשומה.
  • מערכי נתונים מגיעים מ-BigQuery.

המסננים Systems,‏ Type aliases,‏ Project ו-Datasets מוצגים בהתאם לשאילתה הנוכחית בשדה Search.

כדי להשתמש בחיפוש לפי מילות מפתח בלבד:

המסוף

  1. אם אתם במצב חיפוש בשפה טבעית, לוחצים על חזרה לחיפוש מילות מפתח.
  2. בשדה Find resources across projects (חיפוש משאבים בכל הפרויקטים), מזינים את השאילתה.
  3. כדי לצמצם את החיפוש, משתמשים בחלונית Filters.

    רשימת המסננים הזמינים מופיעה במאמר מסננים לחיפוש לפי מילות מפתח.

    אפשר להוסיף באופן ידני את המסננים הבאים:

    • כדי להוסיף מסנן פרויקט: בקטע פרויקט, לוחצים על הוספת פרויקט. מחפשים פרויקט ספציפי, בוחרים אותו ולוחצים על Open.
    • כדי להוסיף מסנן של סוג היבט: בקטע היבטים, לוחצים על התפריט הוספת סוגי היבטים נוספים. מחפשים תבנית ספציפית, בוחרים אותה ולוחצים על אישור.
  4. אופציונלי: בנוסף לנכסים שזמינים לכם, אתם יכולים לחפש משאבים שזמינים לכולם ב Google Cloud על ידי בחירה באפשרות Include public datasets (הכללת מערכי נתונים ציבוריים).

    הטיפים הבאים יעזרו לכם ליצור שאילתת חיפוש:

    • אם הביטוי לחיפוש מכיל רווחים, צריך להקיף אותו במירכאות. לדוגמה, "search terms".
    • מוסיפים NOT לפני מילת מפתח כדי להתאים לשלילה הלוגית של המסנן keyword:term. אפשר גם להשתמש באופרטורים בוליאניים AND ו-OR כדי לשלב ביטויי חיפוש. האופרטורים AND,‏ OR ו-NOT לא תלויי אותיות רישיות (case-sensitive).

    לדוגמה, NOT column:term מפרטת את כל העמודות מלבד אלה שתואמות למונח שצוין. רשימה של מילות מפתח ומונחים אחרים שאפשר להשתמש בהם בביטוי חיפוש ב-Knowledge Catalog מופיעה במאמר בנושא תחביר חיפוש.

gcloud

כדי לחפש משאבים באמצעות מצב חיפוש של מילות מפתח בלבד, משתמשים בפקודה gcloud dataplex entries search ומשמיטים את הדגל --semantic-search, או משתמשים בדגל --no-semantic-search.

REST

כדי לחפש משאבים באמצעות מצב חיפוש של מילות מפתח בלבד, משתמשים ב-method ‏searchEntries כשפרמטר השאילתה semanticSearch מוגדר ל-false.

מגבלות

אלו המגבלות שחלות על חיפוש:

  • משאבים ציבוריים לא נכללים בחיפוש בשפה טבעית.
  • היבטים שמצורפים לקישורי כניסה לא נכללים בחיפוש בשפה טבעית.

המאמרים הבאים