Required. The completionConfig of the parent dataStore or engine resource name for which the completion is performed, such as projects/*/locations/global/collections/default_collection/dataStores/*/completionConfigprojects/*/locations/global/collections/default_collection/engines/*/completionConfig.
Request body
The request body contains data with the following structure:
Required. The typeahead input used to fetch suggestions. Maximum length is 128 characters.
The query can not be empty for most of the suggestion types. If it is empty, an INVALID_ARGUMENT error is returned. The exception is when the suggestionTypes contains only the type RECENT_SEARCH, the query can be an empty string. The is called "zero prefix" feature, which returns user's recently searched queries given the empty query.
queryModel
string
Specifies the autocomplete query model, which only applies to the QUERY SuggestionType. This overrides any model specified in the Configuration > Autocomplete section of the Cloud console. Currently supported values:
document - Using suggestions generated from user-imported documents.
search-history - Using suggestions generated from the past history of SearchService.Search API calls. Do not use it when there is no traffic for Search API.
user-event - Using suggestions generated from user-imported search events.
document-completable - Using suggestions taken directly from user-imported document fields marked as completable.
Default values:
document is the default model for regular dataStores.
search-history is the default model for site search dataStores.
userPseudoId
string
A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor logs in or out of the website.
This field should NOT have a fixed value such as unknown_visitor.
Indicates if tail suggestions should be returned if there are no suggestions that match the full query. Even if set to true, if there are suggestions that match the full query, those are returned and no tail suggestions are returned.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-30 UTC."],[[["\u003cp\u003eThe HTTP request to complete a query is a POST request to a specific URL that uses gRPC Transcoding syntax, targeting a completion configuration resource.\u003c/p\u003e\n"],["\u003cp\u003eThe request body requires a 'query' string of up to 128 characters, along with optional fields like 'queryModel', 'userPseudoId', 'userInfo', and others to refine suggestions.\u003c/p\u003e\n"],["\u003cp\u003e'queryModel' specifies the source of the suggestions, such as user-imported documents, search history, or user-imported search events, with different defaults for regular and site search data stores.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization for this API requires the OAuth scope \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e and the IAM permission \u003ccode\u003ediscoveryengine.completionConfigs.completeQuery\u003c/code\u003e on the \u003ccode\u003ecompletionConfig\u003c/code\u003e resource.\u003c/p\u003e\n"],["\u003cp\u003eA successful request returns an instance of \u003ccode\u003eAdvancedCompleteQueryResponse\u003c/code\u003e, with the type and specifics of the suggestions in the response being dependent on the parameters specified in the request body.\u003c/p\u003e\n"]]],[],null,["# Method: projects.locations.collections.dataStores.completionConfig.completeQuery\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [IAM Permissions](#body.aspect_1)\n\nCompletes the user input with advanced keyword suggestions.\n\n### HTTP request\n\n`POST https://discoveryengine.googleapis.com/v1beta/{completionConfig=projects/*/locations/*/collections/*/dataStores/*/completionConfig}:completeQuery`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nIf successful, the response body contains an instance of [AdvancedCompleteQueryResponse](/generative-ai-app-builder/docs/reference/rest/v1beta/AdvancedCompleteQueryResponse).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/cloud-platform`\n- `https://www.googleapis.com/auth/cloud_search.query`\n- `https://www.googleapis.com/auth/discoveryengine.complete_query`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp).\n\n### IAM Permissions\n\nRequires the following [IAM](https://cloud.google.com/iam/docs) permission on the `completionConfig` resource:\n\n- `discoveryengine.completionConfigs.completeQuery`\n\nFor more information, see the [IAM documentation](https://cloud.google.com/iam/docs)."]]