Migrate from Custom Search Site Restricted JSON API

If you use the Custom Search Site Restricted JSON API of Programmable Search Engine, you can create and deploy Google-quality, site-restricted search in minutes, using Vertex AI Search. To deploy your app, you can use the search widget by copying code from the Google Cloud console directly into a web page—no coding required. Or, you can implement an API deployment to have control over how search functionality looks on your website. For more information about using the API, see the REST tab of Get search results for an app with website data and the servingConfigs.search method in the REST reference.

In additional to the standard short snippets that Vertex AI Search returns with search results, you can add advanced features to your search. These include generated summaries of search results, search with follow-ups for context-aware search that allows follow-up questions, and extractive answers for extracted text returned with each search result. Getting these advanced features for your web search requires domain verification and incurs additional indexing costs. For more information, see the Vertex AI Agent Builder pricing page.

Set up Vertex AI Search

To set up Vertex AI Search, follow these steps:

  1. In the Google Cloud console, on the project selector page, select the project that you've been using for the Custom Search Site Restricted JSON API.

  2. Turn on Vertex AI Agent Builder.

Create a search app

To create a search app, follow these steps:

  1. In the Google Cloud console, go to the Agent Builder page.

    Agent Builder

  2. Click Create app.

  3. On the Create App page, under Search for your website, click Create.

  4. Make sure Enterprise edition features is turned on. This is required for website search. For more information, see Enterprise edition features.

  5. Turn off Advanced LLM features. Turning this off gives you functionality similar to the Custom Search Site Restricted JSON API of Programmable Search Engine. Turn this off if you don't need search summarization or search with follow-ups. For more information, see Advanced LLM features.

  6. In the Your app name field, enter a name for your app.

  7. In the External name of your company or organization field, enter the common name for your company or organization.

  8. Select global (Global) as the location for your app, and then click Continue.

  9. On the Data Stores page, click Create data store.

  10. In the Select a data source pane, select Website Content.

  11. Turn off Advanced website indexing indexing. Turning this off gives you functionality similar to the Custom Search Site Restricted JSON API of Programmable Search Engine. Turn this off if you don't need search summarization or search with follow-ups, or if you don't own the domains that you specify. For more information, see Advanced website indexing.

  12. In the Specify URL patterns to index pane, in the Sites to include field, enter the URL patterns of the websites that you want to search, and then click Continue.

  13. In the Configure your data store pane, enter a display name for your data store, and then click Create.

  14. On the Data Stores page, select your new data store, and then click Create.

Deploy the search app

Decide how you plan to authenticate your Vertex AI Search search app: using OAuth 2.0 or an API key. For information about the advantages and disadvantages of each method, see About authentication.

Deploy the search app (OAuth 2.0)

To deploy your search app using OAuth 2.0 authentication, follow these steps:

  1. To set up OAuth 2.0, see On Google Cloud in Authenticate to Vertex AI Agent Builder. Make sure to add the Discovery Engine User or the Discovery Engine Viewer role to the service account.

  2. Deploy your search app in one of the following ways:

Deploy the search app (API key)

To deploy your search app using an API key for authentication, follow these steps:

  1. Create the API key:

    1. In the Google Cloud console, go to the Credentials page.

      Credentials

    2. If you're not already in your project, in the project list at the top of the Google Cloud console page, select your project.

    3. Click Create credentials and then select API key. Don't add any referrer restrictions. Some user privacy settings don't pass the referrer URL.

      • Take note of the generated API key, which you will use when calling the searchLite method.
    4. For increased security, add an HTTP restriction to your API Key to restrict access to the Vertex AI Agent Builder service at https://discoveryengine.googleapis.com/*.

  2. Deploy your search app using the API. See Get search results for an app with website data (API key) and the servingConfigs.searchLite method in the REST reference. To order the results of your web search queries, see Order web search results.

About authentication

The Custom Search Site Restricted JSON API of Programmable Search Engine authenticates using an API key. While, with a couple of exceptions, Vertex AI Search requires OAuth 2.0. If you want to carry on using an API key for authentication, then you need to use the searchLite method through API calls.

If you choose to authenticate through OAuth 2.0, then you need to use the search method and the answer method to query your website, furthermore, you can deploy your search app through the no-code search widget.

The following table lists differences between using the searchLite method with API key authentication and the search and answer methods with OAuth 2.0 authentication.

Feature/Methods searchLite method search method
Authentication API key OAuth 2.0
Search widget available
Search summaries
Search public websites

Next steps