Organízate con las colecciones
Guarda y clasifica el contenido según tus preferencias.
Con Vertex AI Search, puedes buscar imágenes usando una aplicación con datos de sitios web. Proporcionas una consulta en forma de cadena de texto o imagen, y el método default_config.search devuelve imágenes para esa consulta.
Antes de empezar
Asegúrate de que cumples los siguientes requisitos previos. Los requisitos varían en función de si buscas con una consulta de texto o de imagen.
Si buscas con una consulta de texto en la aplicación de búsqueda de tu sitio web, asegúrate de que estén activadas las funciones de la edición Enterprise.
Si buscas con una consulta de imagen en la aplicación de búsqueda de tu sitio web, asegúrate de que estén activadas las siguientes opciones:
En la página Aplicaciones, busca el nombre de tu aplicación y consulta su ID en la columna ID.
Llama al método engines.servingConfigs.search y especifica 1 en search_type. Elige la sintaxis del método
en función de si tu consulta es
texto o bytes de imagen.
[[["Es fácil de entender","easyToUnderstand","thumb-up"],["Me ofreció una solución al problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Es difícil de entender","hardToUnderstand","thumb-down"],["La información o el código de muestra no son correctos","incorrectInformationOrSampleCode","thumb-down"],["Me faltan las muestras o la información que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-21 (UTC)."],[[["\u003cp\u003eVertex AI Search enables searching for images within website data using either a text string or an image as the query input.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize image search, Enterprise edition features and advanced website indexing must be enabled within your app's settings.\u003c/p\u003e\n"],["\u003cp\u003eImage search functionality is initiated using the \u003ccode\u003eengines.servingConfigs.search\u003c/code\u003e method via command line, which is preferred over the datastore search method, and specifying \u003ccode\u003e1\u003c/code\u003e for the \u003ccode\u003esearch_type\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWhen using the command line, you will need to use your project ID and app ID, as well as a text query or base64-encoded image bytes.\u003c/p\u003e\n"],["\u003cp\u003eThe search results provide detailed information about the matching images, including the title of the webpage containing the image, the image URL, the context link, size, and dimensions.\u003c/p\u003e\n"]]],[],null,["# Search for images on websites\n\nWith Vertex AI Search, you can search for images using a app with\nwebsite data. You supply a query in the form of a text string or an image, and\nthe `default_config.search` method returns images for that query.\n| **Note:** Image search is not available using the Google Cloud console.\n\nBefore you begin\n----------------\n\nMake sure you satisfy the following prerequisites. Requirements vary depending\non whether you search using a text query or an image query.\n\n- If you search using a text query in your website search app, make sure the\n following is turned on: [Enterprise edition features](/generative-ai-app-builder/docs/about-advanced-features#enterprise-features)\n\n- If you search using an image query in your website search app, make sure the\n following are turned on:\n\n - [Enterprise edition features](/generative-ai-app-builder/docs/about-advanced-features#enterprise-features)\n\n - [Advanced website indexing](/generative-ai-app-builder/docs/about-advanced-features#advanced-website-indexing)\n\nPreview image search\n--------------------\n\nTo use the command line to preview image results for a website,\nuse the [`engines.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search) method:\n| **Note:** You can search over an app using the [`engines.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search) method and you can search over a data store using the [`dataStores.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.dataStores.servingConfigs/search) method. For the following procedure, Google recommends searching using the `engines.servingConfigs.search` method.\n\n1. Find your app ID. If you already have your app ID, skip to the next step.\n\n 1. In the Google Cloud console, go to the **AI Applications** page.\n\n [Go to Apps](https://console.cloud.google.com/gen-app-builder/engines)\n 2. On the **Apps** page, find the name of your app and get the app's ID from\n the **ID** column.\n\n2. Call the\n [`engines.servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search)\n method, specifying `1` for the `search_type`. Choose the method syntax\n depending on whether your query is\n text or image bytes.\n\n **Key Term:** In Vertex AI Search, the term *app* can be used interchangeably with the term *engine* in the context of APIs. \n\n ### Query is a text string\n\n curl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n -H \"X-Goog-User-Project: \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\" \\\n \"https://discoveryengine.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/engines/\u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e/servingConfigs/default_config:search\" \\\n -d '{\n \"servingConfig\": \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/engines/\u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e/servingConfigs/default_search\",\n \"query\": \"\u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e\",\n \"pageSize\": \"\u003cvar translate=\"no\"\u003ePAGE_SIZE\u003c/var\u003e\",\n \"offset\": \"\u003cvar translate=\"no\"\u003eOFFSET\u003c/var\u003e\",\n \"params\": {\"search_type\": 1}\n }'\n\n ### Query is an image\n\n curl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json\" \\\n -H \"X-Goog-User-Project: \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\" \\\n \"https://discoveryengine.googleapis.com/v1beta/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/engines/\u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e/servingConfigs/default_search:search\" \\\n -d '{\n \"servingConfig\": \"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/global/collections/default_collection/engines/\u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e/servingConfigs/default_search\",\n \"imageQuery\": {\"imageBytes\":\"\u003cvar translate=\"no\"\u003eIMAGE_BYTES\u003c/var\u003e\"},\n \"pageSize\": \"\u003cvar translate=\"no\"\u003ePAGE_SIZE\u003c/var\u003e\",\n \"offset\": \"\u003cvar translate=\"no\"\u003eOFFSET\u003c/var\u003e\",\n \"params\": {\"search_type\": 1}\n }'\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your project.\n\n - \u003cvar translate=\"no\"\u003eAPP_ID\u003c/var\u003e: the ID of your app.\n\n - \u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e: the search query text. For example, \"Round headlight\n cars\" or \"show me dress with stripes.\"\n\n - \u003cvar translate=\"no\"\u003eIMAGE_BYTES\u003c/var\u003e: the image in Base64 encoded bytes. Supported\n formats are JPEG, PNG, and BMP.\n\n - \u003cvar translate=\"no\"\u003ePAGE_SIZE\u003c/var\u003e: optional. The number of results returned by the\n search. The default value is 10 for website search.\n\n - Values below 0 cause an error.\n - Values above 100 cause the value to be set to 100.\n - \u003cvar translate=\"no\"\u003eOFFSET\u003c/var\u003e: optional. The starting index of the results.\n The default value is 0.\n\n For example, if the offset is 2 and the page size is 10, results 2\n through 11 are returned.\n3. Review the response. See the following table for field descriptions:"]]