Migrer depuis l'API JSON Custom Search Site Restricted
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Si vous utilisez l'API JSON Custom Search Site Restricted de Programmable Search Engine, vous pouvez créer et déployer une recherche de qualité Google limitée à un site en quelques minutes à l'aide de Vertex AI Search. Pour déployer votre application, vous pouvez utiliser le widget de recherche en copiant le code de la console Google Cloud directement dans une page Web. Vous n'avez pas besoin de coder. Vous pouvez également implémenter un déploiement d'API pour contrôler l'apparence de la fonctionnalité de recherche sur votre site Web.
Pour en savoir plus sur l'utilisation de l'API, consultez l'onglet "REST" de la page Obtenir les résultats de recherche pour une application avec des données de site Web et la méthode servingConfigs.search dans la documentation de référence REST.
En plus des brefs extraits standards que Vertex AI Search renvoie avec les résultats de recherche, vous pouvez ajouter des fonctionnalités avancées à votre recherche. Il s'agit, entre autres, des résumés générés des résultats de recherche, de la recherche avec questions complémentaires pour une recherche contextuelle qui permet de poser des questions complémentaires et des réponses extractives pour le texte extrait renvoyé avec chaque résultat de recherche. Pour bénéficier de ces fonctionnalités avancées pour la recherche sur le Web, vous devez valider votre domaine. Des frais d'indexation supplémentaires s'appliquent.
Vous pouvez également filtrer ou trier vos résultats de recherche, et appliquer des paramètres de promotion pour afficher un lien en tant que résultat sponsorisé.
Pour configurer Vertex AI Search, procédez comme suit :
Dans la console Google Cloud , sur la page de sélection du projet, sélectionnez le projet que vous avez utilisé pour l'API JSON Custom Search Site Restricted.
Sur la page Créer une application, sous Recherche sur site avec le mode IA, cliquez sur Créer.
Assurez-vous que les fonctionnalités de l'édition Enterprise sont activées. Ce paramètre est obligatoire pour la recherche sur le site Web. Pour en savoir plus, consultez Fonctionnalités de l'édition Enterprise.
Désactivez l'option Fonctionnalités LLM avancées. Si vous désactivez cette option, vous bénéficiez d'une fonctionnalité semblable à l'API JSON Custom Search Site Restricted de Programmable Search Engine. Désactivez cette option si vous n'avez pas besoin de la synthèse de recherche ni de la recherche avec questions de suivi. Pour en savoir plus, consultez Fonctionnalités LLM avancées.
Dans le champ Nom de votre application, saisissez le nom de votre application.
Dans le champ Nom externe de votre entreprise ou organisation, saisissez le nom commun de votre entreprise ou organisation.
Sélectionnez global (Global) comme emplacement pour votre application, puis cliquez sur Continuer.
Sur la page Datastores, cliquez sur Créer un data store.
Dans le volet Sélectionner une source de données, sélectionnez Contenu de site Web.
Désactivez l'indexation avancée de site Web. Si vous désactivez cette option, vous bénéficierez de fonctionnalités semblables à celles de l'API JSON Custom Search Site Restricted de Programmable Search Engine. Désactivez cette option si vous n'avez pas besoin de résumés de recherche ni de recherches avec questions complémentaires, ou si vous n'êtes pas propriétaire des domaines que vous spécifiez. Pour en savoir plus, consultez Indexation avancée de sites Web.
Dans le champ Sites à inclure du volet Spécifier les formats d'URL à indexer, saisissez les formats d'URL des sites Web sur lesquels vous souhaitez effectuer des recherches, puis cliquez sur Continuer.
Dans le volet Configurer votre data store, saisissez un nom à afficher pour votre data store, puis cliquez sur Créer.
Sur la page Data stores, sélectionnez votre nouveau data store, puis cliquez sur Créer.
Déployer l'application de recherche
Choisissez comment authentifier votre application de recherche Vertex AI Search : à l'aide d'OAuth 2.0 ou d'une clé API. Pour en savoir plus sur les avantages et les inconvénients de chaque méthode, consultez À propos de l'authentification.
Si vous n'êtes pas déjà dans votre projet, sélectionnez-le dans la liste des projets en haut de la page de la console Google Cloud .
Cliquez sur Créer des identifiants, puis sélectionnez Clé API.
N'ajoutez aucune restriction de référent. Certains paramètres de confidentialité de l'utilisateur ne transmettent pas l'URL de provenance.
Prenez note de la clé API générée, que vous utiliserez lors des appels à la méthode searchLite.
Pour renforcer la sécurité, ajoutez une restriction HTTP à votre clé API afin de restreindre l'accès au service AI Applications à l'adresse https://discoveryengine.googleapis.com/*.
L'API JSON Custom Search Site Restricted de Programmable Search Engine s'authentifie à l'aide d'une clé API. Tandis que Vertex AI Search nécessite OAuth 2.0, à quelques exceptions près.
Si vous souhaitez continuer à utiliser une clé API pour l'authentification, vous devez utiliser la méthode searchLite lors des appels d'API.
Si vous choisissez de vous authentifier via OAuth 2.0, vous devez utiliser les méthodes search et answer pour interroger votre site Web. De plus, vous pouvez déployer votre application de recherche via le widget de recherche sans code.
Le tableau suivant répertorie les différences entre l'utilisation de la méthode searchLite avec l'authentification par clé API et les méthodes search et answer avec l'authentification OAuth 2.0.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/05 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/05 (UTC)."],[[["\u003cp\u003eVertex AI Search enables the creation of site-restricted search functionality, similar to the Custom Search Site Restricted JSON API, with options for both widget-based and API-driven deployment.\u003c/p\u003e\n"],["\u003cp\u003eAdvanced features such as generated summaries, follow-up questions, and extractive answers are available, although they require domain verification and incur additional indexing costs.\u003c/p\u003e\n"],["\u003cp\u003eYou can refine search results through filtering, ordering, and promoting specific links, providing greater control over how information is presented to users.\u003c/p\u003e\n"],["\u003cp\u003eDeploying Vertex AI Search can be done using either OAuth 2.0 or an API key, with OAuth 2.0 supporting the search widget, while API key authentication requires the use of the \u003ccode\u003esearchLite\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eSetting up a website search app involves a series of steps in the Agent Builder console, including selecting website content as the data source and specifying the URL patterns to index.\u003c/p\u003e\n"]]],[],null,["# Migrate from Custom Search Site Restricted JSON API\n\nIf you use the [Custom Search Site Restricted JSON API](https://developers.google.com/custom-search/v1/site_restricted_api) of Programmable Search Engine, you can create and\ndeploy Google-quality, site-restricted search in minutes, using\nVertex AI Search. To deploy your app, you can use the [search\nwidget](/generative-ai-app-builder/docs/add-widget) by copying code from the Google Cloud console directly into a\nweb page---no coding required. Or, you can implement an API\ndeployment to have control over how search functionality looks on your website.\nFor more information about using the API, see the REST tab of [Get search\nresults for an app with website data](/generative-ai-app-builder/docs/preview-search-results#web) and the\n[`servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search) method in the REST reference.\n\nIn addition to the standard short snippets that\nVertex AI Search returns with search results, you can add\nadvanced features to your search. These include generated\n[summaries](/generative-ai-app-builder/docs/get-search-summaries) of search results, [search with follow-ups](/generative-ai-app-builder/docs/answer#commands_for_follow-up_questions) for context-aware search that allows follow-up questions,\nand [extractive answers](/generative-ai-app-builder/docs/snippets#extractive-answers) for extracted text returned with\neach search result. Getting these advanced features for your web search requires\n[domain verification](/generative-ai-app-builder/docs/domain-verification) and incurs additional indexing costs.\n\nYou can also [filter](/generative-ai-app-builder/docs/filter-website-search#filter-expressions-basic-indexing) or [order](/generative-ai-app-builder/docs/order-web-search-results#basic-indexing) your\nsearch results and apply [promote controls](/generative-ai-app-builder/docs/configure-serving-controls#promote) to display a link as a promoted result.\n\nFor more information, see the [AI Applications pricing](/generative-ai-app-builder/pricing) page.\n\nSet up Vertex AI Search\n-----------------------\n\nTo set up Vertex AI Search, follow these steps:\n\n1. In the Google Cloud console, on the [project selector\n page](https://console.cloud.google.com/projectselector2/home/dashboard), select the project that you've been\n using for the Custom Search Site Restricted JSON API.\n\n2. [Turn on AI Applications](/generative-ai-app-builder/docs/before-you-begin#turn-on-discovery-engine).\n\nCreate a search app\n-------------------\n\nTo create a search app, follow these steps:\n\n1. In the Google Cloud console, go to the **AI Applications** page.\n\n [AI Applications](https://console.cloud.google.com/gen-app-builder/engines)\n2. Click **Create app**.\n\n3. On the **Create App** page, under **Site search with AI mode** , click\n **Create**.\n\n4. Make sure **Enterprise edition features** is turned on. This is required\n for website search. For more information, see [Enterprise edition\n features](/generative-ai-app-builder/docs/about-advanced-features#enterprise-features).\n\n5. Turn off **Advanced LLM features** . Turning this off gives you\n functionality similar to the Custom Search Site Restricted JSON API of\n Programmable Search Engine. Turn this off if you don't need search\n summarization or search with follow-ups. For more information, see\n [Advanced LLM features](/generative-ai-app-builder/docs/about-advanced-features#advanced-llm-features).\n\n6. In the **Your app name** field, enter a name for your app.\n\n7. In the **External name of your company or organization** field, enter\n the common name for your company or organization.\n\n8. Select **global (Global)** as the location for your app, and then click\n **Continue**.\n\n9. On the **Data Stores** page, click **Create data store**.\n\n10. In the **Select a data source** pane, select **Website Content**.\n\n11. Turn off **Advanced website indexing** indexing. Turning this off gives\n you functionality similar to the Custom Search Site Restricted JSON API\n of Programmable Search Engine. Turn this off if you don't need search\n summarization or search with follow-ups, or if you don't own the\n domains that you specify. For more information, see\n [Advanced website indexing](/generative-ai-app-builder/docs/about-advanced-features#advanced-website-indexing).\n\n12. In the **Specify URL patterns to index** pane, in the **Sites\n to include** field, enter the URL patterns of the websites that you want\n to search, and then click **Continue**.\n\n13. In the **Configure your data store** pane, enter a display name for your\n data store, and then click **Create**.\n\n14. On the **Data Stores** page, select your new data store, and then click\n **Create**.\n\nDeploy the search app\n---------------------\n\nDecide how you plan to authenticate your Vertex AI Search search\napp: using OAuth 2.0 or an API key. For information about the advantages and\ndisadvantages of each method, see [About\nauthentication](#about-authentication).\n\n- [To deploy the search app with OAuth 2.0](#oauth-deploy)\n\n- [To deploy the search app with an API key](#api-key-deploy)\n\n### Deploy the search app (OAuth 2.0)\n\nTo deploy your search app using OAuth 2.0 authentication, follow these steps:\n\n1. To set up OAuth 2.0, see [On Google Cloud](/generative-ai-app-builder/docs/authentication#on-gcp) in *Authenticate to\n AI Applications* . Make sure to add the [Discovery Engine\n User](/generative-ai-app-builder/docs/access-control#discoveryengine.user) or the [Discovery Engine\n Viewer](/generative-ai-app-builder/docs/access-control#discoveryengine.viewer) role to the service account.\n\n2. Deploy your search app in one of the following ways:\n\n - **Use the search widget.** Deploy your search\n app with no coding required. For more information, see\n [Add the search widget to a web page](/generative-ai-app-builder/docs/add-widget).\n\n - **Use the API.** Use the API to control how search functionality looks on\n your website. For more information, see the REST tab of [Get search\n results for an app with website data](/generative-ai-app-builder/docs/preview-search-results#web) and the\n [`servingConfigs.search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/search) method in the REST reference. To\n order the results of your web search queries, see [Order web search\n results](/generative-ai-app-builder/docs/order-web-search-results).\n\n### Deploy the search app (API key)\n\nTo deploy your search app using an API key for authentication, follow these\nsteps:\n\n1. Create the API key:\n\n 1. In the Google Cloud console, go to the **Credentials** page.\n\n [Credentials](https://console.cloud.google.com/apis/credentials)\n 2. If you're not already in your project, in the project list at the top of\n the Google Cloud console page, select your project.\n\n 3. Click **Create credentials** and then select **API key** .\n *Don't add any referrer restrictions*. Some user privacy settings don't\n pass the referrer URL.\n\n - Take note of the generated API key, which you will use when calling the `searchLite` method.\n 4. For increased security, add an\n [HTTP restriction](/docs/authentication/api-keys#api_key_restrictions)\n to your API Key to restrict access to the AI Applications service\n at `https://discoveryengine.googleapis.com/*`.\n\n2. Deploy your search app using the API.\n See [Get search results for an app with website data (API\n key)](/generative-ai-app-builder/docs/preview-search-results#web-api-key) and the\n [`servingConfigs.searchLite`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/searchLite) method in the\n REST reference. To order the results of your web search queries, see [Order\n web search results](/generative-ai-app-builder/docs/order-web-search-results).\n\nAbout authentication\n--------------------\n\nThe [Custom Search Site Restricted JSON API](https://developers.google.com/custom-search/v1/site_restricted_api) of\nProgrammable Search Engine authenticates using an API key. While, with a\ncouple of exceptions, Vertex AI Search requires OAuth 2.0.\nIf you want to carry on using an API key for authentication, then you need to\nuse the [`searchLite`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines.servingConfigs/searchLite) method through API calls.\n\nIf you choose to authenticate through OAuth 2.0, then you need to use the\n[`search`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.servingConfigs/search) method and the [`answer`](/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.dataStores.servingConfigs/answer) method to query\nyour website, furthermore, you can deploy your search app through the no-code\nsearch widget.\n\nThe following table lists differences between using the `searchLite` method with\nAPI key authentication and the `search` and `answer` methods with OAuth 2.0\nauthentication.\n\nNext steps\n----------\n\n- If you need to filter the search results, see [Filter expressions\n for basic website search](/generative-ai-app-builder/docs/filter-website-search#filter-expressions-basic-indexing).\n\n- If you need to provide image search, see [Search for images on\n websites](/generative-ai-app-builder/docs/image-search).\n\n- If you need to order the search results, for example by date, see [Order\n search results for basic website search](/generative-ai-app-builder/docs/order-web-search-results#basic-indexing).\n\n- If you need multi-turn search, see [Commands for follow-up\n questions](/generative-ai-app-builder/docs/answer#commands_for_follow-up_questions)."]]