- HTTP request
- Request body
- Response body
- Authorization scopes
- SuggestResult
- QuerySuggestion
- PeopleSuggestion
- Try it!
Provides suggestions for autocompleting the query.
Note:This API requires a standard end user account to execute. A service account can't perform query API requests directly; to use a service account to perform queries, set up Google Workspace domain-wide delegation of authority .
HTTP request
POST https://cloudsearch.googleapis.com/v1/query/suggest
The URL uses gRPC Transcoding syntax.
Request body
The request body contains data with the following structure:
| JSON representation |
|---|
{ "requestOptions" : { object ( |
query
string
Partial query for which autocomplete suggestions will be shown. For example, if the query is "sea", then the server might return "season", "search", "seagull" and so on.
dataSourceRestrictions[]
object (
DataSourceRestriction
)
The sources to use for suggestions. If not specified, the data sources are taken from the current search application.
NOTE: Suggestions are only supported for the following sources:
- Third-party data sources
- PredefinedSource.PERSON
- PredefinedSource.GOOGLE_DRIVE
Response body
Response of the suggest API.
If successful, the response body contains data with the following structure:
| JSON representation |
|---|
{
"suggestResults"
:
[
{
object (
|
| Fields | |
|---|---|
suggestResults[]
|
List of suggestions. |
Authorization scopes
Requires one of the following OAuth scopes:
-
https://www.googleapis.com/auth/cloud_search.query -
https://www.googleapis.com/auth/cloud_search
For more information, see the Authorization guide .
SuggestResult
One suggestion result.
| JSON representation |
|---|
{ "suggestedQuery" : string , "source" : { object ( |
suggestedQuery
string
The suggested query that will be used for search, when the user clicks on the suggestion
source
object (
Source
)
The source of the suggestion.
suggestion
. Contains additional metadata about the suggested query. It also indicates the type of the suggested query. For e.g. if PeopleSuggestion is present, it indicates that suggested_query is a person suggestion. suggestion
can be only one of the following:querySuggestion
object (
QuerySuggestion
)
This field will be present if the suggested query is a word/phrase completion.
peopleSuggestion
object (
PeopleSuggestion
)
This is present when the suggestion indicates a person. It contains more information about the person - like their email id, name etc.
QuerySuggestion
This type has no fields.
This field does not contain anything as of now and is just used as an indicator that the suggest result was a phrase completion.
PeopleSuggestion
This field contains information about the person being suggested.
| JSON representation |
|---|
{
"person"
:
{
object (
|
| Fields | |
|---|---|
person
|
Suggested person. All fields of the person object might not be populated. |

