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:
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.
Create a search app
To create a search app, follow these steps:
In the Google Cloud console, go to the Agent Builder page.
Click Create app.
On the Create app page, select Search.
Click Generic.
Make sure Enterprise edition features is turned on. This is required for website search. For more information, see Enterprise edition features.
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.
In the Your app name field, enter a name for your app.
In the External name of your company or organization field, enter the common name for your company or organization.
Select global (Global) as the location for your app, and then click Continue.
On the Data Stores page, click Create data store.
In the Select a data source pane, select Website Content.
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.
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.
In the Configure your data store pane, enter a display name for your data store, and then click Create.
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:
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.
Deploy your search app in one of the following ways:
Use the search widget. Deploy your search app with no coding required. For more information, see Add the search widget to a web page.
Use the API. Use the API to control how search functionality looks on your website. For more information, see the REST tab of Get search results for an app with website data and the
servingConfigs.search
method in the REST reference. To order the results of your web search queries, see Order web search results.
Deploy the search app (API key)
To deploy your search app using an API key for authentication, follow these steps:
Create the API key:
In the Google Cloud console, go to the Credentials page.
If you're not already in your project, in the project list at the top of the Google Cloud console page, select your project.
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.
- Take note of the generated API key, which you will use when calling
the
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/*
.
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
If you need to filter the search results, see Filter expressions for basic website search.
If you need to provide image search, see Search for images on websites.
If you need to order the search results, for example by date, see Order search results for basic website search.
If you need multi-turn search, see Commands for follow-up questions.