このトピックでは、Vertex AI を搭載したセマンティック検索とフィルタベースの検索オプションを使用して、API Hub で特定のリソースを検索する方法について説明します。
図 1. API Hub には、強力な自然言語検索機能とフィルタ機能が用意されています。
セマンティック検索による API Hub の検索
セマンティック検索を使用すると、API Hub に登録されている API リソースを簡単に検索して表示できます。セマンティック検索では、インスタンスで使用可能なすべての API リソースをフリーテキスト検索クエリによって検索できます。すべてのエンティティ タイプ(API、API オペレーション、仕様など)を検索するか、検索対象のエンティティ タイプを指定できます。
Vertex AI 検索エンジンにより、セマンティック検索は単語の「マッチング」を超えた検索を実現します。詳細な API リソース エントリ内のあらゆる場所から、入力されたフリーテキスト検索クエリと意味的に類似する語句を見つけ出し、その語句が含まれる結果を返します。
フリーテキスト検索では、次のカテゴリの結果が返されます。
API: 検索に一致する API のリスト。API ごとに、次の詳細が提供されます。
API の名前と、API の詳細ページへのリンク。
リソースの簡単な説明。
リソースのオーナーの名前とメールアドレス。
バージョン: 検索に一致する API バージョンのリスト。バージョンごとに、次の詳細が表示されます。
バージョンに関連付けられている API の名前と、API の詳細ページへのリンク。
API バージョンの名前と、バージョンの詳細ページへのリンク。
バージョンの説明とそれに関連するメタデータ。
仕様: 検索に一致する API 仕様のリスト。仕様ごとに、次の詳細情報が提供されます。
仕様に関連付けられている API の名前と、API の詳細ページへのリンク。
API 仕様の名前と、仕様に関連付けられたバージョンの詳細ページへのリンク。
仕様の説明。
仕様ドキュメントへのリンク。
OpenAPI 仕様など、仕様のタイプ。
オペレーション: 検索に一致する API オペレーションのリスト。オペレーションごとに、次の詳細情報が提供されます。
RESOURCE_TYPE は、検索に指定するオプションのフィルタです。次のいずれかの API Hub リソースタイプをフィルタとして指定できます。
Api
ApiOperation
Deployment
Definition
Spec
Version
次に例を示します。
curl-XPOSThttps://apihub.googleapis.com/v1/projects/{project-id}/locations/{location}:searchResources \-H"Authorization: Bearer $(gcloud auth print-access-token)"-H"Content-Type: application/json"\
-d'{"query":"dog status in the store","filter":"resource_type = SPEC"}'
この呼び出しでは、リソース固有のメタデータを含む API Hub リソースのリストが複数のページに分かれて返されます。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-08-28 UTC。"],[[["\u003cp\u003eThis page outlines how to use Semantic Search, powered by Vertex AI, and filter-based options to efficiently search for resources within Apigee and Apigee hybrid's API hub.\u003c/p\u003e\n"],["\u003cp\u003eSemantic Search enables free-text queries to find APIs, versions, specifications, operations, and deployments based on semantically similar terms found in the API resource entries.\u003c/p\u003e\n"],["\u003cp\u003eUsers can search using system or user attributes and refine search results by filtering and clicking on categories in the results, such as APIs, Versions, Specifications, Operations, and Deployments.\u003c/p\u003e\n"],["\u003cp\u003eYou can also use an API call to search resources, where you can specify a query and filter the results by resource type.\u003c/p\u003e\n"],["\u003cp\u003eFilter options allow you to narrow the displayed APIs based on attributes like API name, business unit, team, and documentation, with the ability to use \u003ccode\u003eMatch ALL\u003c/code\u003e or \u003ccode\u003eMatch ANY\u003c/code\u003e criteria.\u003c/p\u003e\n"]]],[],null,["# Search for and filter APIs\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\nThis topic describes how to use Semantic Search powered by [Vertex AI](/vertex-ai/docs) and filter-based search options to search\nfor specific resources in API hub.\n**Figure 1.** API hub provides powerful natural language search and filter features.\n\nSearch API hub using Semantic Search\n------------------------------------\n\nYou can easily find and view API resources registered in your API hub using Semantic Search. Semantic Search allows\nyou to search all available API resources in your instance using a *free-text search query*. You can search across all entity types (APIs, API operations, specifications, and more.),\nor specify the entity type that you want to query.\n\nWith its Vertex AI search engine, Semantic Search can go beyond term \"matching.\" Semantic Search returns results\ncontaining terms found anywhere in the detailed API resource entries that are semantically similar to the free text search queries entered.\n\nFree-text search returns the following categories of results:\n\n- **APIs** : A list of APIs that match the search. For each API, the following details are provided:\n - The name of the API with a link to the API details page.\n - A brief description of the resource.\n - The name and email address of the resource owner.\n- **Versions** : A list of API versions that match the search. For each version, the following details are provided:\n - The names of the APIs associated with the version, with a link that takes you to the API details page.\n - The name of the API version, with a link that takes you to the version details page.\n - The description of the version and related metadata.\n- **Specifications** : A list of API specifications that match the search. For each specification, the following details are provided:\n - The names of the API associated with the specification, with a link that takes you to the API details page.\n - The name of the API specification, with a link that takes you to the version details page associated with the specification.\n - The description of the specification.\n - A link to the specification document.\n - The type of specification, such as OpenAPI spec.\n- **Operations** : A list of API operations that match the search. For each operation, the following details are provided:\n - The names of the API associated with the operation, with a link that takes you to the API details page.\n - The name of the operation, with a link that takes you to the version details page associated with the operation.\n - The description of the specification.\n - A link to the specification document that defines the operation.\n - A link to the version that includes the operation.\n- **Deployments** : A list of deployments that match the search. For each deployment, the following details are provided:\n - The name of the deployment.\n - The description of the deployment.\n - The deployment type. For example, Apigee hybrid.\n - A link to the version that includes the deployment.\n\n\u003cbr /\u003e\n\nTo search for APIs containing a specific term:\n\n1. In the Google Cloud console, go to the API hub **Semantic search** page.\n\n [Go to API hub](https://console.cloud.google.com//apigee/api-hub/search)\n2. Type a search query in the search box.\n\n For example, you could enter \"Order management APIs\" or \"Spec file for wireless carrier settings\".\n\n You can refine your search by using [system attributes](/apigee/docs/apihub/manage-attributes#system-attributes) within your search query prompt. If you created\n [user attributes](/apigee/docs/apihub/manage-attributes#user-attributes) when registering your APIs in API hub, you can also incorporate these attributes in your search query prompts.\n3. The **Search results** are categorized under the following tabs: APIs, Versions, Specifications, Operations, and Deployments. Click one of the tabs to see results for a category. The results display API resources that contain terms semantically similar to the search query you entered.\n4. Click the API resource name to view the detail page for the resource.\n5. To clear the current query, click **Clear results**.\n\nSearch API hub using the API\n----------------------------\n\nYou can also search your API hub resources using the API hub API. The `searchResources` method\nallows you to query your API hub resources using free text queries and filters.\n\nYou can use the following API call to search across your API hub resources: \n\n```carbon\ncurl -X POST https://apihub.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e:searchResources \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" -H \"Content-Type: application/json\" \\\n -d '{\n \"query\":\"\u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e\",\n \"filter\":\"resource_type = \u003cvar translate=\"no\"\u003eRESOURCE_TYPE\u003c/var\u003e\"\n }'\n```\n\nWhere:\n\n- **PROJECT_ID** is the ID of the host project for your API hub instance.\n- **LOCATION** is the location where your API hub instance is hosted.\n- **QUERY** is the free text query to be used in the search. The query can contain keywords related to any detail of the API hub resource, including display names, descriptions, or other metadata..\n- **RESOURCE_TYPE** is the optional filter specified for your search. You can specify one of the following API hub resource types as a filter:\n - `Api`\n - `ApiOperation`\n - `Deployment`\n - `Definition`\n - `Spec`\n - `Version`\n\n\u003cbr /\u003e\n\nFor example: \n\n```carbon\ncurl -X POST https://apihub.googleapis.com/v1/projects/{project-id}/locations/{location}:searchResources \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" -H \"Content-Type: application/json\" \\\n -d '{\n \"query\":\"dog status in the store\",\n \"filter\":\"resource_type = SPEC\"\n }'\n```\n\nThis call returns a paginated list of API hub resources, with resource-specific metadata.\n\nFor more information on free-text search with the API hub API, see the API reference documentation for\n[`Method:project.locations.searchResources`](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources).\n\nFilter-based search options\n---------------------------\n\n\u003cbr /\u003e\n\nYou can refine the list of APIs displayed on the **APIs** page by using system attributes as search parameters.\nCustomize\nthe list of API resources displayed using one of the following:\n\n- [Filter](#filter)\n- [Pagination](#pagination)\n\n### Filter\n\nUsing the filter-based list search, you can streamline your APIs list based on a number of predefined parameters and\nsystem attributes associated with the resource. You can use the `Match ALL` or `Match ANY` options\nto customize your filtered view.\n| **Note:** The filter options available are configured by a user with [administrator permissions](/apigee/docs/apihub/iam-roles). For more information, see [Manage API hub settings](/apigee/docs/apihub/settings-overview) and [Manage attributes](/apigee/docs/apihub/manage-attributes).\n\n\nTo specify filter options:\n\n1. In the Google Cloud console, go to the API hub **APIs** page.\n\n [Go to API hub APIs](https://console.cloud.google.com//apigee/api-hub/apis)\n2. Click in the **Filter table** field to filter the table. The **Filter** pane opens. **Tip:**You can show or hide columns in the APIs table. Use the action menu in the Filter row to select and unselect row names.\n3. Specify or select filter options. When you type in the Filter pane, a menu with filter options pops up that includes a list of [system attributes](/apigee/docs/apihub/manage-attributes#system-attributes) that are relevant to the current context. For example, these are system attributes that you may see when filtering the APIs in the **APIs** page:\n - **API name**: The display name of the API\n - **Business unit:** The business unit responsible for an API\n - **Team:** The producing team responsible for an API\n - **Documentation**: A short link to the API documentation.\n | **Note:** There may be additional attributes listed as filter options. For more information, see [Manage API attributes](/apigee/docs/apihub/manage-attributes).\n - You'll see system attributes in the filter list in the **APIs** , **Versions** , and **Specifications** tables.\n4. After selecting a filter option, select a filter value from the **Values** list. Alternatively, you can enter a value for the filter attribute you select.\n5. To add an additional filter, click in the **Filter table** field to select from the available **Operators** and then select another filter attribute and value.\n6. The selected filter properties display the conditional\n logic that the filter query is using. You can select `OR` as an operator. If no\n operator is selected, the default is `AND`.\n\n7. To clear an individual filter, click the **X** on the filter. To clear all filters, click **Clear all** in the **Filter** pane.\n\n### Pagination\n\nWhen there are multiple API resources, they may be displayed across multiple pages.\n\nTo customize the list display and navigate between pages:\n\n1. In the Google Cloud console, go to the API hub **APIs** page.\n\n [Go to API hub APIs](https://console.cloud.google.com//apigee/api-hub/apis)\n\n The **APIs** list page is displayed by default.\n2. From the **APIs** list, locate the pagination tools\n as shown in Figure 2:\n\n **Figure 2.** Move back and forth through paginated results.\n3. Select the number of APIs to display per page.\n4. Click **\\\u003e Forward**to go to the next page.\n5. Click**\\\u003c Back**to go to the previous page.\n\nWhat's next?\n------------\n\n- Learn how to [Manage deployments](/apigee/docs/apihub/manage-api-deployments)."]]