Spanner To Vertex AI ベクトル検索ワークフローを使用します。これは、ワークフローを使用してデプロイされ、エンベディングをエクスポートしてベクトル検索インデックスにアップロードします。Cloud Scheduler を使用してこのワークフローを定期的にスケジュールすると、Spanner のエンベディングに対する最新の変更を反映してベクトル検索インデックスを最新の状態に維持できます。
次に、ベクトル検索インデックスをクエリし、対応するエンベディングがお客様の検索リクエストから生成されたリクエスト エンベディングと類似しているプロダクト ID を取得します。検索インデックスでは、ウェイクボード ショートパンツ、サーフィン用アパレル、スイミング パンツなど、意味が似ている項目に対して商品 ID が提案されることがあります。
ベクトル検索からこれらの類似した商品 ID が返されたら、Spanner に商品の説明、在庫数、価格、その他の関連するメタデータをクエリして、お客様に表示できます。
[[["わかりやすい","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-09-05 UTC。"],[],[],null,["# Export embeddings from Spanner to Vertex AI Vector Search\n\n[Vertex AI Vector Search](/vertex-ai/docs/vector-search/overview)\nallows users to search for semantically similar items using vector embeddings.\nUsing the [Spanner To Vertex AI Vector Search\nWorkflow](https://github.com/cloudspannerecosystem/spanner-ai/tree/main/vertex-vector-search/workflows#readme),\nyou can integrate your Spanner database with\nVector Search to perform a vector similarity search on your\nSpanner data.\n\nThe following diagram shows the end-to-end application workflow of how\nyou can enable and use Vector Search on your Spanner\ndata:\n\nThe general workflow is as follows:\n\n1. **Generate and store vector embeddings.**\n\n You can generate vector embeddings of your data, then store and\n manage them in Spanner with your operational data. You can\n generate embeddings with Spanner's `ML.PREDICT` SQL\n function to [access the Vertex AI text embedding model](/spanner/docs/ml-tutorial-embeddings#generate-store-embeddings)\n or [use other embedding models deployed to Vertex AI](/spanner/docs/ml-tutorial).\n2. **Sync embeddings to Vector Search.**\n\n Use the [Spanner To Vertex AI Vector Search Workflow](https://github.com/cloudspannerecosystem/spanner-ai/tree/main/vertex-vector-search/workflows#readme),\n which is deployed using [Workflows](/workflows/docs/overview) to\n export and upload embeddings into a Vector Search index. You can use\n Cloud Scheduler to periodically schedule this workflow to keep your\n Vector Search index up to date with the latest changes to your\n embeddings in Spanner.\n3. **Perform vector similarity search using your Vector Search index.**\n\n Query the Vector Search index to search and find results for\n semantically similar items. You can query using a [public endpoint](/vertex-ai/docs/vector-search/query-index-public-endpoint)\n or through [VPC peering](/vertex-ai/docs/vector-search/query-index-vpc).\n\nExample use case\n----------------\n\nAn illustrative use case for Vector Search is an online\nretailer who has an inventory of hundreds of thousands of items. In this\nscenario, you are a developer for an online retailer, and you would\nlike to use vector similarity search on your product catalog in\nSpanner to help your customers find relevant products based on\ntheir search queries.\n\nFollow step 1 and step 2 presented in the general workflow to generate vector\nembeddings for your product catalog, and sync these embeddings to\nVector Search.\n\nNow imagine a customer browsing your application performs a search such as\n\"best, quick-drying sports shorts that I can wear in the water\". When your\napplication receives this query, you need to generate a request embedding for\nthis search request using the Spanner [`ML.PREDICT`](/spanner/docs/reference/standard-sql/ml-functions#mlpredict)\nSQL function. Make sure to use the same embedding model used to generate the\nembeddings for your product catalog.\n\nNext, query the Vector Search index for product IDs whose\ncorresponding embeddings are similar to the request embedding generated from\nyour customer's search request. The search index might recommend product IDs for\nsemantically similar items such as wakeboarding shorts, surfing apparel, and\nswimming trunks.\n\nAfter Vector Search returns these similar product IDs, you can query\nSpanner for the products' descriptions, inventory count, price,\nand other metadata that are relevant, and display them to your customer.\n\nYou can also use [generative AI](/vertex-ai/generative-ai/docs/overview)\nto process the returned results from Spanner before displaying\nthem to your customer. For example, you might use Google's large generative AI\nmodels to generate a concise summary of the recommended products. For more\ninformation, see this tutorial on how to\n[use Generative AI to get personalized recommendations in an ecommerce application](/spanner/docs/ml-tutorial-generative-ai).\n\nWhat's next\n-----------\n\n- Learn how to [generate embeddings](/spanner/docs/ml-tutorial-embeddings) using Spanner.\n- Learn more about [AI's multitool: Vector embeddings](https://cloud.google.com/blog/topics/developers-practitioners/meet-ais-multitool-vector-embeddings)\n- Learn more about machine learning and embeddings in our [crash course on embeddings](https://developers.google.com/machine-learning/crash-course/embeddings/video-lecture).\n- Learn more about the Spanner To Vertex AI Vector Search Workflow, see the [GitHub repository](https://github.com/cloudspannerecosystem/spanner-ai/tree/main/vertex-vector-search/workflows).\n- Learn more about the [open source spanner-analytics package](https://github.com/cloudspannerecosystem/spanner-analytics/) that facilitates common data-analytic operations in Python and includes integrations with Jupyter Notebooks."]]