Completes the user input with advanced keyword suggestions.
HTTP request
POST https://discoveryengine.googleapis.com/v1alpha/{completionConfig=projects/*/locations/*/collections/*/dataStores/*/completionConfig}:completeQuery
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-06-27 UTC."],[[["\u003cp\u003eThe \u003ccode\u003ePOST\u003c/code\u003e request to \u003ccode\u003ehttps://discoveryengine.googleapis.com/v1alpha/{completionConfig=projects/*/locations/*/collections/*/dataStores/*/completionConfig}:completeQuery\u003c/code\u003e is used to complete queries.\u003c/p\u003e\n"],["\u003cp\u003eThe request requires a \u003ccode\u003ecompletionConfig\u003c/code\u003e path parameter, which is a string representing the resource name, and the request body includes fields like \u003ccode\u003equery\u003c/code\u003e, \u003ccode\u003euserPseudoId\u003c/code\u003e, and \u003ccode\u003esuggestionTypes\u003c/code\u003e to specify the completion.\u003c/p\u003e\n"],["\u003cp\u003eThe request body's \u003ccode\u003equery\u003c/code\u003e field is required, with a maximum length of 128 characters, except when \u003ccode\u003esuggestionTypes\u003c/code\u003e is \u003ccode\u003eRECENT_SEARCH\u003c/code\u003e, allowing an empty query for recent search retrieval.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003equeryModel\u003c/code\u003e parameter allows overriding the Cloud console's model, with supported values including \u003ccode\u003edocument\u003c/code\u003e, \u003ccode\u003esearch-history\u003c/code\u003e, \u003ccode\u003euser-event\u003c/code\u003e, and \u003ccode\u003edocument-completable\u003c/code\u003e to define the source of the suggestion generation.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful requests return an \u003ccode\u003eAdvancedCompleteQueryResponse\u003c/code\u003e, and authorization requires specific OAuth scopes or the \u003ccode\u003ediscoveryengine.completionConfigs.completeQuery\u003c/code\u003e IAM permission.\u003c/p\u003e\n"]]],[],null,[]]