[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-27。"],[],[],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."]]