Package google.cloud.discoveryengine.v1beta

Index

CompletionService

Service for Auto-Completion.

CompleteQuery

rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse)

Completes the specified user input with keyword suggestions.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the dataStore resource:

  • discoveryengine.dataStores.completeQuery

For more information, see the IAM documentation.

ConversationalSearchService

Service for conversational search.

ConverseConversation

rpc ConverseConversation(ConverseConversationRequest) returns (ConverseConversationResponse)

Converses a conversation.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • discoveryengine.conversations.converse

For more information, see the IAM documentation.

CreateConversation

rpc CreateConversation(CreateConversationRequest) returns (Conversation)

Creates a Conversation.

If the Conversation to create already exists, an ALREADY_EXISTS error is returned.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • discoveryengine.conversations.create

For more information, see the IAM documentation.

DeleteConversation

rpc DeleteConversation(DeleteConversationRequest) returns (Empty)

Deletes a Conversation.

If the Conversation to delete does not exist, a NOT_FOUND error is returned.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • discoveryengine.conversations.delete

For more information, see the IAM documentation.

GetConversation

rpc GetConversation(GetConversationRequest) returns (Conversation)

Gets a Conversation.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • discoveryengine.conversations.get

For more information, see the IAM documentation.

ListConversations

rpc ListConversations(ListConversationsRequest) returns (ListConversationsResponse)

Lists all Conversations by their parent DataStore.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • discoveryengine.conversations.list

For more information, see the IAM documentation.

UpdateConversation

rpc UpdateConversation(UpdateConversationRequest) returns (Conversation)

Updates a Conversation.

Conversation action type cannot be changed. If the Conversation to update does not exist, a NOT_FOUND error is returned.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • discoveryengine.conversations.update

For more information, see the IAM documentation.

DocumentService

Service for ingesting Document information of the customer's website.

CreateDocument

rpc CreateDocument(CreateDocumentRequest) returns (Document)

Creates a Document.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • discoveryengine.documents.create

For more information, see the IAM documentation.

DeleteDocument

rpc DeleteDocument(DeleteDocumentRequest) returns (Empty)

Deletes a Document.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • discoveryengine.documents.delete

For more information, see the IAM documentation.

GetDocument

rpc GetDocument(GetDocumentRequest) returns (Document)

Gets a Document.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • discoveryengine.documents.get

For more information, see the IAM documentation.

ImportDocuments

rpc ImportDocuments(ImportDocumentsRequest) returns (Operation)

Bulk import of multiple Documents. Request processing may be synchronous. Non-existing items will be created.

Note: It is possible for a subset of the Documents to be successfully updated.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • discoveryengine.documents.import

For more information, see the IAM documentation.

ListDocuments

rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse)

Gets a list of Documents.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • discoveryengine.documents.list

For more information, see the IAM documentation.

PurgeDocuments

rpc PurgeDocuments(PurgeDocumentsRequest) returns (Operation)

Permanently deletes all selected Documents in a branch.

This process is asynchronous. Depending on the number of Documents to be deleted, this operation can take hours to complete. Before the delete operation completes, some Documents might still be returned by DocumentService.GetDocument or DocumentService.ListDocuments.

To get a list of the Documents to be deleted, set PurgeDocumentsRequest.force to false.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • discoveryengine.documents.purge

For more information, see the IAM documentation.

UpdateDocument

rpc UpdateDocument(UpdateDocumentRequest) returns (Document)

Updates a Document.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • discoveryengine.documents.update

For more information, see the IAM documentation.

RecommendationService

Service for making recommendations.

Recommend

rpc Recommend(RecommendRequest) returns (RecommendResponse)

Makes a recommendation, which requires a contextual user event.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the servingConfig resource:

  • discoveryengine.servingConfigs.recommend

For more information, see the IAM documentation.

SchemaService

Service for managing Schemas.

CreateSchema

rpc CreateSchema(CreateSchemaRequest) returns (Operation)

Creates a Schema.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • discoveryengine.schemas.create

For more information, see the IAM documentation.

DeleteSchema

rpc DeleteSchema(DeleteSchemaRequest) returns (Operation)

Deletes a Schema.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • discoveryengine.schemas.delete

For more information, see the IAM documentation.

GetSchema

rpc GetSchema(GetSchemaRequest) returns (Schema)

Gets a Schema.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • discoveryengine.schemas.get

For more information, see the IAM documentation.

ListSchemas

rpc ListSchemas(ListSchemasRequest) returns (ListSchemasResponse)

Gets a list of Schemas.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • discoveryengine.schemas.list

For more information, see the IAM documentation.

UpdateSchema

rpc UpdateSchema(UpdateSchemaRequest) returns (Operation)

Updates a Schema.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • discoveryengine.schemas.update

For more information, see the IAM documentation.

SearchService

Service for search.

Search

rpc Search(SearchRequest) returns (SearchResponse)

Performs a search.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the servingConfig resource:

  • discoveryengine.servingConfigs.search

For more information, see the IAM documentation.

UserEventService

Service for ingesting end user actions on a website to Discovery Engine API.

CollectUserEvent

rpc CollectUserEvent(CollectUserEventRequest) returns (HttpBody)

Writes a single user event from the browser. This uses a GET request to due to browser restriction of POST-ing to a third-party domain.

This method is used only by the Discovery Engine API JavaScript pixel and Google Tag Manager. Users should not call this method directly.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

ImportUserEvents

rpc ImportUserEvents(ImportUserEventsRequest) returns (Operation)

Bulk import of User events. Request processing might be synchronous. Events that already exist are skipped. Use this method for backfilling historical user events.

Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully inserted. Operation.metadata is of type ImportMetadata.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • discoveryengine.userEvents.import

For more information, see the IAM documentation.

WriteUserEvent

rpc WriteUserEvent(WriteUserEventRequest) returns (UserEvent)

Writes a single user event.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • discoveryengine.userEvents.create

For more information, see the IAM documentation.

BigQuerySource

BigQuery source import data from.

Fields
project_id

string

The project ID (can be project # or ID) that the BigQuery source is in with a length limit of 128 characters. If not specified, inherits the project ID from the parent request.

dataset_id

string

Required. The BigQuery data set to copy the data from with a length limit of 1,024 characters.

table_id

string

Required. The BigQuery table to copy the data from with a length limit of 1,024 characters.

gcs_staging_dir

string

Intermediate Cloud Storage directory used for the import with a length limit of 2,000 characters. Can be specified if one wants to have the BigQuery export to a specific Cloud Storage directory.

data_schema

string

The schema to use when parsing the data from the source.

Supported values for user event imports:

  • user_event (default): One UserEvent per row.

Supported values for document imports:

Union field partition. BigQuery table partition info. Leave this empty if the BigQuery table is not partitioned. partition can be only one of the following:
partition_date

Date

BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.

CollectUserEventRequest

Request message for CollectUserEvent method.

Fields
parent

string

Required. The parent DataStore resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}.

user_event

string

Required. URL encoded UserEvent proto with a length limit of 2,000,000 characters.

uri

string

The URL including cgi-parameters but excluding the hash fragment with a length limit of 5,000 characters. This is often more useful than the referer URL, because many browsers only send the domain for third-party requests.

ets

int64

The event timestamp in milliseconds. This prevents browser caching of otherwise identical get requests. The name is abbreviated to reduce the payload bytes.

CompleteQueryRequest

Request message for CompletionService.CompleteQuery method.

Fields
data_store

string

Required. The parent data store resource name for which the completion is performed, such as projects/*/locations/global/collections/default_collection/dataStores/default_data_store.

query

string

Required. The typeahead input used to fetch suggestions. Maximum length is 128 characters.

query_model

string

Selects data model of query suggestions for serving. 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.
user_pseudo_id

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.

This should be the same identifier as UserEvent.user_pseudo_id and SearchRequest.user_pseudo_id.

The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

include_tail_suggestions

bool

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.

CompleteQueryResponse

Response message for CompletionService.CompleteQuery method.

Fields
query_suggestions[]

QuerySuggestion

Results of the matched query suggestions. The result list is ordered and the first result is a top suggestion.

tail_match_triggered

bool

True if the returned suggestions are all tail suggestions.

For tail matching to be triggered, include_tail_suggestions in the request must be true and there must be no suggestions that match the full query.

QuerySuggestion

Suggestions as search queries.

Fields
suggestion

string

The suggestion for the query.

completable_field_paths[]

string

The unique document field paths that serve as the source of this suggestion if it was generated from completable fields.

This field is only populated for the document-completable model.

CompletionInfo

Detailed completion information including completion attribution token and clicked completion info.

Fields
selected_suggestion

string

End user selected CompleteQueryResponse.QuerySuggestion.suggestion.

selected_position

int32

End user selected CompleteQueryResponse.QuerySuggestion.suggestion position, starting from 0.

Conversation

External conversation proto definition.

Fields
name

string

Immutable. Fully qualified name project/*/locations/global/collections/{collection}/dataStore/*/conversations/*

state

State

The state of the Conversation.

user_pseudo_id

string

A unique identifier for tracking users.

messages[]

ConversationMessage

Conversation messages.

start_time

Timestamp

Output only. The time the conversation started.

end_time

Timestamp

Output only. The time the conversation finished.

State

Enumeration of the state of the conversation.

Enums
STATE_UNSPECIFIED Unknown.
IN_PROGRESS Conversation is currently open.
COMPLETED Conversation has been completed.

ConversationContext

Defines context of the conversation

Fields
context_documents[]

string

The current list of documents the user is seeing. It contains the document resource references.

active_document

string

The current active document the user opened. It contains the document resource reference.

ConversationMessage

Defines a conversation message.

Fields
create_time

Timestamp

Output only. Message creation timestamp.

Union field message.

message can be only one of the following:

user_input

TextInput

User text input.

reply

Reply

Search reply.

ConverseConversationRequest

Request message for ConversationalSearchService.ConverseConversation method.

Fields
name

string

Required. The resource name of the Conversation to get. Format: projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}. Use projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/- to activate auto session mode, which automatically creates a new conversation inside a ConverseConversation session.

query

TextInput

Required. Current user input.

serving_config

string

The resource name of the Serving Config to use. Format: projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/servingConfigs/{serving_config_id} If this is not set, the default serving config will be used.

conversation

Conversation

The conversation to be used by auto session only. The name field will be ignored as we automatically assign new name for the conversation in auto session.

user_labels

map<string, string>

The user labels applied to a resource must meet the following requirements:

  • Each resource can have multiple labels, up to a maximum of 64.
  • Each label must be a key-value pair.
  • Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
  • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
  • The key portion of a label must be unique. However, you can use the same key with multiple resources.
  • Keys must start with a lowercase letter or international character.

See Google Cloud Document for more details.

summary_spec

SummarySpec

A specification for configuring the summary returned in the response.

ConverseConversationResponse

Response message for ConversationalSearchService.ConverseConversation method.

Fields
reply

Reply

Answer to the current query.

conversation

Conversation

Updated conversation including the answer.

related_questions[]

string

Suggested related questions.

search_results[]

SearchResult

Search Results.

CreateConversationRequest

Request for CreateConversation method.

Fields
parent

string

Required. Full resource name of parent data store. Format: projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}

conversation

Conversation

Required. The conversation to create.

CreateDocumentRequest

Request message for DocumentService.CreateDocument method.

Fields
parent

string

Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}.

document

Document

Required. The Document to create.

document_id

string

Required. The ID to use for the Document, which will become the final component of the Document.name.

If the caller does not have permission to create the Document, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

This field must be unique among all Documents with the same parent. Otherwise, an ALREADY_EXISTS error is returned.

This field must conform to RFC-1034 standard with a length limit of 63 characters. Otherwise, an INVALID_ARGUMENT error is returned.

CreateSchemaMetadata

Metadata for Create Schema LRO.

Fields
create_time

Timestamp

Operation create time.

update_time

Timestamp

Operation last update time. If the operation is done, this is also the finish time.

CreateSchemaRequest

Request message for SchemaService.CreateSchema method.

Fields
parent

string

Required. The parent data store resource name, in the format of projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}.

schema

Schema

Required. The Schema to create.

schema_id

string

Required. The ID to use for the Schema, which will become the final component of the Schema.name.

This field should conform to RFC-1034 standard with a length limit of 63 characters.

CustomAttribute

A custom attribute that is not explicitly modeled in a resource, e.g. UserEvent.

Fields
text[]

string

The textual values of this custom attribute. For example, ["yellow", "green"] when the key is "color".

Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is returned.

Exactly one of CustomAttribute.text or CustomAttribute.numbers should be set. Otherwise, an INVALID_ARGUMENT error is returned.

numbers[]

double

The numerical values of this custom attribute. For example, [2.3, 15.4] when the key is "lengths_cm".

Exactly one of CustomAttribute.text or CustomAttribute.numbers should be set. Otherwise, an INVALID_ARGUMENT error is returned.

DeleteConversationRequest

Request for DeleteConversation method.

Fields
name

string

Required. The resource name of the Conversation to delete. Format: projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}

DeleteDocumentRequest

Request message for DocumentService.DeleteDocument method.

Fields
name

string

Required. Full resource name of Document, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to delete the Document, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the Document to delete does not exist, a NOT_FOUND error is returned.

DeleteSchemaMetadata

Metadata for DeleteSchema LRO.

Fields
create_time

Timestamp

Operation create time.

update_time

Timestamp

Operation last update time. If the operation is done, this is also the finish time.

DeleteSchemaRequest

Request message for SchemaService.DeleteSchema method.

Fields
name

string

Required. The full resource name of the schema, in the format of projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}.

Document

Document captures all raw metadata information of items to be recommended or searched.

Fields
name

string

Immutable. The full resource name of the document. Format: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}.

This field must be a UTF-8 encoded string with a length limit of 1024 characters.

id

string

Immutable. The identifier of the document.

Id should conform to RFC-1034 standard with a length limit of 63 characters.

schema_id

string

The identifier of the schema located in the same data store.

content

Content

The unstructured data linked to this document. Content must be set if this document is under a CONTENT_REQUIRED data store.

parent_document_id

string

The identifier of the parent document. Currently supports at most two level document hierarchy.

Id should conform to RFC-1034 standard with a length limit of 63 characters.

derived_struct_data

Struct

Output only. This field is OUTPUT_ONLY. It contains derived data that are not in the original input document.

Union field data. Data representation. One of struct_data or json_data should be provided otherwise an INVALID_ARGUMENT error is thrown. data can be only one of the following:
struct_data

Struct

The structured JSON data for the document. It should conform to the registered Schema or an INVALID_ARGUMENT error is thrown.

json_data

string

The JSON string representation of the document. It should conform to the registered Schema or an INVALID_ARGUMENT error is thrown.

Content

Unstructured data linked to this document.

Fields
mime_type

string

The MIME type of the content. Supported types:

  • application/pdf (PDF, only native PDFs are supported for now)
  • text/html (HTML)
  • application/vnd.openxmlformats-officedocument.wordprocessingml.document (DOCX)
  • application/vnd.openxmlformats-officedocument.presentationml.presentation (PPTX)
  • text/plain (TXT)

See https://www.iana.org/assignments/media-types/media-types.xhtml.

Union field content.

content can be only one of the following:

raw_bytes

bytes

The content represented as a stream of bytes. The maximum length is 1,000,000 bytes (1 MB / ~0.95 MiB).

Note: As with all bytes fields, this field is represented as pure binary in Protocol Buffers and base64-encoded string in JSON. For example, abc123!?$*&()'-=@~ should be represented as YWJjMTIzIT8kKiYoKSctPUB+ in JSON. See https://developers.google.com/protocol-buffers/docs/proto3#json.

uri

string

The URI of the content. Only Cloud Storage URIs (e.g. gs://bucket-name/path/to/file) are supported. The maximum file size is 100 MB.

DocumentInfo

Detailed document information associated with a user event.

Fields
promotion_ids[]

string

The promotion IDs associated with this Document. Currently, this field is restricted to at most one ID.

Union field document_descriptor. A required descriptor of the associated Document.

  • If id is specified, then the default values for {location}, {collection_id}, {data_store_id}, and {branch_id} are used when annotating with the stored Document.

  • If name is specified, then the provided values (default values allowed) for {location}, {collection_id}, {data_store_id}, and {branch_id} are used when annotating with the stored Document. document_descriptor can be only one of the following:

id

string

The Document resource ID.

name

string

The Document resource full name, of the form: projects/{project_id}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}/branches/{branch_id}/documents/{document_id}

uri

string

The Document URI - only allowed for website data stores.

quantity

int32

Quantity of the Document associated with the user event. Defaults to 1.

For example, this field will be 2 if two quantities of the same Document are involved in a add-to-cart event.

Required for events of the following event types:

  • add-to-cart
  • purchase

DoubleList

Double list.

Fields
values[]

double

Double values.

GcsSource

Cloud Storage location for input content.

Fields
input_uris[]

string

Required. Cloud Storage URIs to input files. URI can be up to 2000 characters long. URIs can match the full object path (for example, gs://bucket/directory/object.json) or a pattern matching one or more files, such as gs://bucket/directory/*.json.

A request can contain at most 100 files (or 100,000 files if data_schema is content). Each file can be up to 2 GB (or 100 MB if data_schema is content).

data_schema

string

The schema to use when parsing the data from the source.

Supported values for document imports:

  • document (default): One JSON Document per line. Each document must have a valid Document.id.
  • content: Unstructured data (e.g. PDF, HTML). Each file matched by input_uris becomes a document, with the ID set to the first 128 bits of SHA256(URI) encoded as a hex string.
  • custom: One custom data JSON per row in arbitrary format that conforms to the defined Schema of the data store. This can only be used by Gen App Builder.
  • csv: A CSV file with header conforming to the defined Schema of the data store. Each entry after the header is imported as a Document. This can only be used by Gen App Builder.

Supported values for user even imports:

  • user_event (default): One JSON UserEvent per line.

GetConversationRequest

Request for GetConversation method.

Fields
name

string

Required. The resource name of the Conversation to get. Format: projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}

GetDocumentRequest

Request message for DocumentService.GetDocument method.

Fields
name

string

Required. Full resource name of Document, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to access the Document, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the requested Document does not exist, a NOT_FOUND error is returned.

GetSchemaRequest

Request message for SchemaService.GetSchema method.

Fields
name

string

Required. The full resource name of the schema, in the format of projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}.

ImportDocumentsMetadata

Metadata related to the progress of the ImportDocuments operation. This is returned by the google.longrunning.Operation.metadata field.

Fields
create_time

Timestamp

Operation create time.

update_time

Timestamp

Operation last update time. If the operation is done, this is also the finish time.

success_count

int64

Count of entries that were processed successfully.

failure_count

int64

Count of entries that encountered errors while processing.

ImportDocumentsRequest

Request message for Import methods.

Fields
parent

string

Required. The parent branch resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}. Requires create/update permission.

error_config

ImportErrorConfig

The desired location of errors incurred during the Import.

reconciliation_mode

ReconciliationMode

The mode of reconciliation between existing documents and the documents to be imported. Defaults to ReconciliationMode.INCREMENTAL.

auto_generate_ids

bool

Whether to automatically generate IDs for the documents if absent.

If set to true, Document.ids are automatically generated based on the hash of the payload, where IDs may not be consistent during multiple imports. In which case ReconciliationMode.FULL is highly recommended to avoid duplicate contents. If unset or set to false, Document.ids have to be specified using id_field, otherwise, documents without IDs fail to be imported.

Only set this field when using GcsSource or BigQuerySource, and when GcsSource.data_schema or BigQuerySource.data_schema is custom or csv. Otherwise, an INVALID_ARGUMENT error is thrown.

id_field

string

The field in the Cloud Storage and BigQuery sources that indicates the unique IDs of the documents.

For GcsSource it is the key of the JSON field. For instance, my_id for JSON {"my_id": "some_uuid"}. For BigQuerySource it is the column name of the BigQuery table where the unique ids are stored.

The values of the JSON field or the BigQuery column are used as the Document.ids. The JSON field or the BigQuery column must be of string type, and the values must be set as valid strings conform to RFC-1034 with 1-63 characters. Otherwise, documents without valid IDs fail to be imported.

Only set this field when using GcsSource or BigQuerySource, and when GcsSource.data_schema or BigQuerySource.data_schema is custom. And only set this field when auto_generate_ids is unset or set as false. Otherwise, an INVALID_ARGUMENT error is thrown.

If it is unset, a default value _id is used when importing from the allowed data sources.

Union field source. Required. The source of the input. source can be only one of the following:
inline_source

InlineSource

The Inline source for the input content for documents.

gcs_source

GcsSource

Cloud Storage location for the input content.

bigquery_source

BigQuerySource

BigQuery input source.

InlineSource

The inline source for the input config for ImportDocuments method.

Fields
documents[]

Document

Required. A list of documents to update/create. Each document must have a valid Document.id. Recommended max of 100 items.

ReconciliationMode

Indicates how imported documents are reconciled with the existing documents created or imported before.

Enums
RECONCILIATION_MODE_UNSPECIFIED Defaults to INCREMENTAL.
INCREMENTAL Inserts new documents or updates existing documents.
FULL Calculates diff and replaces the entire document dataset. Existing documents may be deleted if they are not present in the source location.

ImportDocumentsResponse

Response of the ImportDocumentsRequest. If the long running operation is done, then this message is returned by the google.longrunning.Operations.response field if the operation was successful.

Fields
error_samples[]

Status

A sample of errors encountered while processing the request.

error_config

ImportErrorConfig

Echoes the destination for the complete errors in the request if set.

ImportErrorConfig

Configuration of destination for Import related errors.

Fields
Union field destination. Required. Errors destination. destination can be only one of the following:
gcs_prefix

string

Cloud Storage prefix for import errors. This must be an empty, existing Cloud Storage directory. Import errors are written to sharded files in this directory, one per line, as a JSON-encoded google.rpc.Status message.

ImportUserEventsMetadata

Metadata related to the progress of the Import operation. This is returned by the google.longrunning.Operation.metadata field.

Fields
create_time

Timestamp

Operation create time.

update_time

Timestamp

Operation last update time. If the operation is done, this is also the finish time.

success_count

int64

Count of entries that were processed successfully.

failure_count

int64

Count of entries that encountered errors while processing.

ImportUserEventsRequest

Request message for the ImportUserEvents request.

Fields
parent

string

Required. Parent DataStore resource name, of the form projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}

error_config

ImportErrorConfig

The desired location of errors incurred during the Import. Cannot be set for inline user event imports.

Union field source. Required - The desired input source of the user event data. source can be only one of the following:
inline_source

InlineSource

The Inline source for the input content for UserEvents.

gcs_source

GcsSource

Cloud Storage location for the input content.

bigquery_source

BigQuerySource

BigQuery input source.

InlineSource

The inline source for the input config for ImportUserEvents method.

Fields
user_events[]

UserEvent

Required. A list of user events to import. Recommended max of 10k items.

ImportUserEventsResponse

Response of the ImportUserEventsRequest. If the long running operation was successful, then this message is returned by the google.longrunning.Operations.response field if the operation was successful.

Fields
error_samples[]

Status

A sample of errors encountered while processing the request.

error_config

ImportErrorConfig

Echoes the destination for the complete errors if this field was set in the request.

joined_events_count

int64

Count of user events imported with complete existing Documents.

unjoined_events_count

int64

Count of user events imported, but with Document information not found in the existing Branch.

Interval

A floating point interval.

Fields

Union field min. The lower bound of the interval. If neither of the min fields are set, then the lower bound is negative infinity.

This field must be not larger than max. Otherwise, an INVALID_ARGUMENT error is returned. min can be only one of the following:

minimum

double

Inclusive lower bound.

exclusive_minimum

double

Exclusive lower bound.

Union field max. The upper bound of the interval. If neither of the max fields are set, then the upper bound is positive infinity.

This field must be not smaller than min. Otherwise, an INVALID_ARGUMENT error is returned. max can be only one of the following:

maximum

double

Inclusive upper bound.

exclusive_maximum

double

Exclusive upper bound.

ListConversationsRequest

Request for ListConversations method.

Fields
parent

string

Required. The data store resource name. Format: projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}

page_size

int32

Maximum number of results to return. If unspecified, defaults to 50. Max allowed value is 1000.

page_token

string

A page token, received from a previous ListConversations call. Provide this to retrieve the subsequent page.

filter

string

A filter to apply on the list results. The supported features are: user_pseudo_id, state.

Example: "user_pseudo_id = some_id"

order_by

string

A comma-separated list of fields to order by, sorted in ascending order. Use "desc" after a field name for descending. Supported fields: * update_time * create_time * conversation_name

Example: "update_time desc" "create_time"

ListConversationsResponse

Response for ListConversations method.

Fields
conversations[]

Conversation

All the Conversations for a given data store.

next_page_token

string

Pagination token, if not returned indicates the last page.

ListDocumentsRequest

Request message for DocumentService.ListDocuments method.

Fields
parent

string

Required. The parent branch resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}. Use default_branch as the branch ID, to list documents under the default branch.

If the caller does not have permission to list Documents under this branch, regardless of whether or not this branch exists, a PERMISSION_DENIED error is returned.

page_size

int32

Maximum number of Documents to return. If unspecified, defaults to 100. The maximum allowed value is 1000. Values above 1000 will be coerced to 1000.

If this field is negative, an INVALID_ARGUMENT error is returned.

page_token

string

A page token ListDocumentsResponse.next_page_token, received from a previous DocumentService.ListDocuments call. Provide this to retrieve the subsequent page.

When paginating, all other parameters provided to DocumentService.ListDocuments must match the call that provided the page token. Otherwise, an INVALID_ARGUMENT error is returned.

ListDocumentsResponse

Response message for DocumentService.ListDocuments method.

Fields
documents[]

Document

The Documents.

next_page_token

string

A token that can be sent as ListDocumentsRequest.page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

ListSchemasRequest

Request message for SchemaService.ListSchemas method.

Fields
parent

string

Required. The parent data store resource name, in the format of projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}.

page_size

int32

The maximum number of Schemas to return. The service may return fewer than this value.

If unspecified, at most 100 Schemas will be returned.

The maximum value is 1000; values above 1000 will be coerced to 1000.

page_token

string

A page token, received from a previous SchemaService.ListSchemas call. Provide this to retrieve the subsequent page.

When paginating, all other parameters provided to SchemaService.ListSchemas must match the call that provided the page token.

ListSchemasResponse

Response message for SchemaService.ListSchemas method.

Fields
schemas[]

Schema

The Schemas.

next_page_token

string

A token that can be sent as ListSchemasRequest.page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

MediaInfo

Media-specific user event information.

Fields
media_progress_duration

Duration

The media progress time in seconds, if applicable. For example, if the end user has finished 90 seconds of a playback video, then MediaInfo.media_progress_duration.seconds should be set to 90.

media_progress_percentage

float

Media progress should be computed using only the media_progress_duration relative to the media total length.

This value must be between [0, 1.0] inclusive.

If this is not a playback or the progress cannot be computed (e.g. ongoing livestream), this field should be unset.

PageInfo

Detailed page information.

Fields
pageview_id

string

A unique ID of a web page view.

This should be kept the same for all user events triggered from the same pageview. For example, an item detail page view could trigger multiple events as the user is browsing the page. The pageview_id property should be kept the same for all these events so that they can be grouped together properly.

When using the client side event reporting with JavaScript pixel and Google Tag Manager, this value is filled in automatically.

page_category

string

The most specific category associated with a category page.

To represent full path of category, use '>' sign to separate different hierarchies. If '>' is part of the category name, please replace it with other character(s).

Category pages include special pages such as sales or promotions. For instance, a special sale page may have the category hierarchy: "pageCategory" : "Sales > 2017 Black Friday Deals".

Required for view-category-page events. Other event types should not set this field. Otherwise, an INVALID_ARGUMENT error is returned.

uri

string

Complete URL (window.location.href) of the user's current page.

When using the client side event reporting with JavaScript pixel and Google Tag Manager, this value is filled in automatically. Maximum length 5,000 characters.

referrer_uri

string

The referrer URL of the current page.

When using the client side event reporting with JavaScript pixel and Google Tag Manager, this value is filled in automatically. However, some browser privacy restrictions may cause this field to be empty.

PanelInfo

Detailed panel information associated with a user event.

Fields
panel_id

string

Required. The panel ID.

display_name

string

The display name of the panel.

panel_position

int32

The ordered position of the panel, if shown to the user with other panels. If set, then total_panels must also be set.

total_panels

int32

The total number of panels, including this one, shown to the user. Must be set if panel_position is set.

PurgeDocumentsMetadata

Metadata related to the progress of the PurgeDocuments operation. This will be returned by the google.longrunning.Operation.metadata field.

Fields
create_time

Timestamp

Operation create time.

update_time

Timestamp

Operation last update time. If the operation is done, this is also the finish time.

success_count

int64

Count of entries that were deleted successfully.

failure_count

int64

Count of entries that encountered errors while processing.

PurgeDocumentsRequest

Request message for DocumentService.PurgeDocuments method.

Fields
parent

string

Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}.

filter

string

Required. Filter matching documents to purge. Only currently supported value is * (all items).

force

bool

Actually performs the purge. If force is set to false, return the expected purge count without deleting any documents.

PurgeDocumentsResponse

Response message for DocumentService.PurgeDocuments method. If the long running operation is successfully done, then this message is returned by the google.longrunning.Operations.response field.

Fields
purge_count

int64

The total count of documents purged as a result of the operation.

purge_sample[]

string

A sample of document names that will be deleted. Only populated if force is set to false. A max of 100 names will be returned and the names are chosen at random.

RecommendRequest

Request message for Recommend method.

Fields
serving_config

string

Required. Full resource name of the format: projects/*/locations/global/collections/*/dataStores/*/servingConfigs/*

Before you can request recommendations from your model, you must create at least one serving config for it.

user_event

UserEvent

Required. Context about the user, what they are looking at and what action they took to trigger the Recommend request. Note that this user event detail won't be ingested to userEvent logs. Thus, a separate userEvent write request is required for event logging.

Don't set UserEvent.user_pseudo_id or UserEvent.user_info.user_id to the same fixed ID for different users. If you are trying to receive non-personalized recommendations (not recommended; this can negatively impact model performance), instead set UserEvent.user_pseudo_id to a random unique ID and leave UserEvent.user_info.user_id unset.

page_size

int32

Maximum number of results to return. Set this property to the number of recommendation results needed. If zero, the service will choose a reasonable default. The maximum allowed value is 100. Values above 100 will be coerced to 100.

filter

string

Filter for restricting recommendation results with a length limit of 5,000 characters. Currently, only filter expressions on the filter_tags attribute is supported.

Examples:

  • (filter_tags: ANY("Red", "Blue") OR filter_tags: ANY("Hot", "Cold"))
  • (filter_tags: ANY("Red", "Blue")) AND NOT (filter_tags: ANY("Green"))

If your filter blocks all results, the API will return generic (unfiltered) popular Documents. If you only want results strictly matching the filters, set strictFiltering to True in RecommendRequest.params to receive empty results instead.

Note that the API will never return Documents with storageStatus of EXPIRED or DELETED regardless of filter choices.

validate_only

bool

Use validate only mode for this recommendation query. If set to true, a fake model will be used that returns arbitrary Document IDs. Note that the validate only mode should only be used for testing the API, or if the model is not ready.

params

map<string, Value>

Additional domain specific parameters for the recommendations.

Allowed values:

  • returnDocument: Boolean. If set to true, the associated Document object will be returned in RecommendResponse.RecommendationResult.document.
  • returnScore: Boolean. If set to true, the recommendation 'score' corresponding to each returned Document will be set in RecommendResponse.RecommendationResult.metadata. The given 'score' indicates the probability of a Document conversion given the user's context and history.
  • strictFiltering: Boolean. True by default. If set to false, the service will return generic (unfiltered) popular Documents instead of empty if your filter blocks all recommendation results.
  • diversityLevel: String. Default empty. If set to be non-empty, then it needs to be one of:
    • no-diversity
    • low-diversity
    • medium-diversity
    • high-diversity
    • auto-diversity This gives request-level control and adjusts recommendation results based on Document category.
user_labels

map<string, string>

The user labels applied to a resource must meet the following requirements:

  • Each resource can have multiple labels, up to a maximum of 64.
  • Each label must be a key-value pair.
  • Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
  • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
  • The key portion of a label must be unique. However, you can use the same key with multiple resources.
  • Keys must start with a lowercase letter or international character.

See Requirements for labels for more details.

RecommendResponse

Response message for Recommend method.

Fields
results[]

RecommendationResult

A list of recommended Documents. The order represents the ranking (from the most relevant Document to the least).

attribution_token

string

A unique attribution token. This should be included in the UserEvent logs resulting from this recommendation, which enables accurate attribution of recommendation model performance.

missing_ids[]

string

IDs of documents in the request that were missing from the default Branch associated with the requested ServingConfig.

validate_only

bool

True if RecommendRequest.validate_only was set.

RecommendationResult

RecommendationResult represents a generic recommendation result with associated metadata.

Fields
id

string

Resource ID of the recommended Document.

document

Document

Set if returnDocument is set to true in RecommendRequest.params.

metadata

map<string, Value>

Additional Document metadata / annotations.

Possible values:

Reply

Defines a reply message to user.

Fields
reply
(deprecated)

string

DEPRECATED: use summary instead. Text reply.

references[]
(deprecated)

Reference

References in the reply.

summary

Summary

Summary based on search results.

Reference

Defines reference in reply.

Fields
uri

string

URI link reference.

anchor_text

string

Anchor text.

start

int32

Anchor text start index.

end

int32

Anchor text end index.

Schema

Defines the structure and layout of a type of document data.

Fields
name

string

Immutable. The full resource name of the schema, in the format of projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}.

This field must be a UTF-8 encoded string with a length limit of 1024 characters.

Union field schema. Schema representation. One of struct_schema or json_schema should be provided otherwise an INVALID_ARGUMENT error is thrown. schema can be only one of the following:
struct_schema

Struct

The structured representation of the schema.

json_schema

string

The JSON representation of the schema.

SearchInfo

Detailed search information.

Fields
search_query

string

The user's search query.

See SearchRequest.query for definition.

The value must be a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

At least one of search_query or PageInfo.page_category is required for search events. Other event types should not set this field. Otherwise, an INVALID_ARGUMENT error is returned.

order_by

string

The order in which products are returned, if applicable.

See SearchRequest.order_by for definition and syntax.

The value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

This can only be set for search events. Other event types should not set this field. Otherwise, an INVALID_ARGUMENT error is returned.

offset

int32

An integer that specifies the current offset for pagination (the 0-indexed starting location, amongst the products deemed by the API as relevant).

See SearchRequest.offset for definition.

If this field is negative, an INVALID_ARGUMENT is returned.

This can only be set for search events. Other event types should not set this field. Otherwise, an INVALID_ARGUMENT error is returned.

SearchRequest

Request message for SearchService.Search method.

Fields
serving_config

string

Required. The resource name of the Search serving config, such as projects/*/locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config. This field is used to identify the serving configuration name, set of models used to make the search.

branch

string

The branch resource name, such as projects/*/locations/global/collections/default_collection/dataStores/default_data_store/branches/0.

Use default_branch as the branch ID or leave this field empty, to search documents under the default branch.

query

string

Raw search query.

image_query

ImageQuery

Raw image query.

page_size

int32

Maximum number of Documents to return. If unspecified, defaults to a reasonable value. The maximum allowed value is 100. Values above 100 are coerced to 100.

If this field is negative, an INVALID_ARGUMENT is returned.

page_token

string

A page token received from a previous SearchService.Search call. Provide this to retrieve the subsequent page.

When paginating, all other parameters provided to SearchService.Search must match the call that provided the page token. Otherwise, an INVALID_ARGUMENT error is returned.

offset

int32

A 0-indexed integer that specifies the current offset (that is, starting result location, amongst the Documents deemed by the API as relevant) in search results. This field is only considered if page_token is unset.

If this field is negative, an INVALID_ARGUMENT is returned.

filter

string

The filter syntax consists of an expression language for constructing a predicate from one or more fields of the documents being filtered. Filter expression is case-sensitive.

If this field is unrecognizable, an INVALID_ARGUMENT is returned.

order_by

string

The order in which documents are returned. Documents can be ordered by a field in an Document object. Leave it unset if ordered by relevance. order_by expression is case-sensitive.

If this field is unrecognizable, an INVALID_ARGUMENT is returned.

user_info

UserInfo

Information about the end user. Highly recommended for analytics. UserInfo.user_agent is used to deduce device_type for analytics.

facet_specs[]

FacetSpec

Facet specifications for faceted search. If empty, no facets are returned.

A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error is returned.

boost_spec

BoostSpec

Boost specification to boost certain documents.

params

map<string, Value>

Additional search parameters.

For public website search only, supported values are:

  • user_country_code: string. Default empty. If set to non-empty, results are restricted or boosted based on the location provided.
  • search_type: double. Default empty. Enables non-webpage searching depending on the value. The only valid non-default value is 1, which enables image searching.
query_expansion_spec

QueryExpansionSpec

The query expansion specification that specifies the conditions under which query expansion occurs.

spell_correction_spec

SpellCorrectionSpec

The spell correction specification that specifies the mode under which spell correction takes effect.

user_pseudo_id

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.

This should be the same identifier as UserEvent.user_pseudo_id and CompleteQueryRequest.user_pseudo_id

The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

content_search_spec

ContentSearchSpec

A specification for configuring the behavior of content search.

embedding_spec

EmbeddingSpec

Uses the provided embedding to do additional semantic document retrieval. The retrieval is based on the dot product of [SearchRequest.embedding_spec.embedding_vectors.vector][] and the document embedding that is provided in [SearchRequest.embedding_spec.embedding_vectors.field_path][].

If [SearchRequest.embedding_spec.embedding_vectors.field_path][] is not provided, it will use [ServingConfig.embedding_config.field_paths][].

ranking_expression

string

The ranking expression controls the customized ranking on retrieval documents. This overrides [ServingConfig.ranking_expression][]. The ranking expression is a single function or multiple functions that are joint by "+". * ranking_expression = function, { " + ", function }; Supported functions: * double * relevance_score * double * dotProduct(embedding_field_path) Function variables: relevance_score: pre-defined keywords, used for measure relevance between query and document. embedding_field_path: the document embedding field used with query embedding vector. dotProduct: embedding function between embedding_field_path and query embedding vector.

Example ranking expression: If document has an embedding field doc_embedding, the ranking expression could be 0.5 * relevance_score + 0.3 * dotProduct(doc_embedding).

user_labels

map<string, string>

The user labels applied to a resource must meet the following requirements:

  • Each resource can have multiple labels, up to a maximum of 64.
  • Each label must be a key-value pair.
  • Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
  • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
  • The key portion of a label must be unique. However, you can use the same key with multiple resources.
  • Keys must start with a lowercase letter or international character.

See Google Cloud Document for more details.

BoostSpec

Boost specification to boost certain documents.

Fields
condition_boost_specs[]

ConditionBoostSpec

Condition boost specifications. If a document matches multiple conditions in the specifictions, boost scores from these specifications are all applied and combined in a non-linear way. Maximum number of specifications is 20.

ConditionBoostSpec

Boost applies to documents which match a condition.

Fields
condition

string

An expression which specifies a boost condition. The syntax and supported fields are the same as a filter expression. See SearchRequest.filter for detail syntax and limitations.

Examples:

  • To boost documents with document ID "doc_1" or "doc_2", and color "Red" or "Blue":
    • (id: ANY("doc_1", "doc_2")) AND (color: ANY("Red","Blue"))
boost

float

Strength of the condition boost, which should be in [-1, 1]. Negative boost means demotion. Default is 0.0.

Setting to 1.0 gives the document a big promotion. However, it does not necessarily mean that the boosted document will be the top result at all times, nor that other documents will be excluded. Results could still be shown even when none of them matches the condition. And results that are significantly more relevant to the search query can still trump your heavily favored but irrelevant documents.

Setting to -1.0 gives the document a big demotion. However, results that are deeply relevant might still be shown. The document will have an upstream battle to get a fairly high ranking, but it is not blocked out completely.

Setting to 0.0 means no boost applied. The boosting condition is ignored.

ContentSearchSpec

A specification for configuring the behavior of content search.

Fields
snippet_spec

SnippetSpec

If snippetSpec is not specified, snippets are not included in the search response.

summary_spec

SummarySpec

If summarySpec is not specified, summaries are not included in the search response.

extractive_content_spec

ExtractiveContentSpec

If there is no extractive_content_spec provided, there will be no extractive answer in the search response.

ExtractiveContentSpec

A specification for configuring the extractive content in a search response.

Fields
max_extractive_answer_count

int32

The maximum number of extractive answers returned in each search result.

An extractive answer is a verbatim answer extracted from the original document, which provides a precise and contextually relevant answer to the search query.

If the number of matching answers is less than the max_extractive_answer_count, return all of the answers. Otherwise, return the max_extractive_answer_count.

At most one answer is returned for each SearchResult.

max_extractive_segment_count

int32

The max number of extractive segments returned in each search result. Only applied if the DataStore is set to DataStore.ContentConfig.CONTENT_REQUIRED or DataStore.solution_types is SOLUTION_TYPE_CHAT.

An extractive segment is a text segment extracted from the original document that is relevant to the search query, and, in general, more verbose than an extractive answer. The segment could then be used as input for LLMs to generate summaries and answers.

If the number of matching segments is less than max_extractive_segment_count, return all of the segments. Otherwise, return the max_extractive_segment_count.

num_previous_segments

int32

Specifies whether to also include the adjacent from each selected segments. Return at most num_previous_segments segments before each selected segments.

num_next_segments

int32

Return at most num_next_segments segments after each selected segments.

SnippetSpec

A specification for configuring snippets in a search response.

Fields
max_snippet_count
(deprecated)

int32

[DEPRECATED] This field is deprecated. To control snippet return, use return_snippet field. For backwards compatibility, we will return snippet if max_snippet_count > 0.

reference_only
(deprecated)

bool

[DEPRECATED] This field is deprecated and will have no affect on the snippet.

return_snippet

bool

If true, then return snippet. If no snippet can be generated, we return "No snippet is available for this page." A snippet_status with SUCCESS or NO_SNIPPET_AVAILABLE will also be returned.

SummarySpec

A specification for configuring a summary returned in a search response.

Fields
summary_result_count

int32

The number of top results to generate the summary from. If the number of results returned is less than summaryResultCount, the summary is generated from all of the results.

At most five results can be used to generate a summary.

include_citations

bool

Specifies whether to include citations in the summary. The default value is false.

When this field is set to true, summaries include in-line citation numbers.

Example summary including citations:

BigQuery is Google Cloud's fully managed and completely serverless enterprise data warehouse [1]. BigQuery supports all data types, works across clouds, and has built-in machine learning and business intelligence, all within a unified platform [2, 3].

The citation numbers refer to the returned search results and are 1-indexed. For example, [1] means that the sentence is attributed to the first search result. [2, 3] means that the sentence is attributed to both the second and third search results.

ignore_adversarial_query

bool

Specifies whether to filter out adversarial queries. The default value is false.

Google employs search-query classification to detect adversarial queries. No summary is returned if the search query is classified as an adversarial query. For example, a user might ask a question regarding negative comments about the company or submit a query designed to generate unsafe, policy-violating output. If this field is set to true, we skip generating summaries for adversarial queries and return fallback messages instead.

ignore_non_summary_seeking_query

bool

Specifies whether to filter out queries that are not summary-seeking. The default value is false.

Google employs search-query classification to detect summary-seeking queries. No summary is returned if the search query is classified as a non-summary seeking query. For example, why is the sky blue and Who is the best soccer player in the world? are summary-seeking queries, but SFO airport and world cup 2026 are not. They are most likely navigational queries. If this field is set to true, we skip generating summaries for non-summary seeking queries and return fallback messages instead.

language_code

string

Language code for Summary. Use language tags defined by BCP47. Note: This is an experimental feature.

EmbeddingSpec

The specification that uses customized query embedding vector to do semantic document retrieval.

Fields
embedding_vectors[]

EmbeddingVector

The embedding vector used for retrieval. Limit to 1.

EmbeddingVector

Embedding vector.

Fields
field_path

string

Embedding field path in schema.

vector[]

float

Query embedding vector.

FacetSpec

A facet specification to perform faceted search.

Fields
facet_key

FacetKey

Required. The facet key specification.

limit

int32

Maximum of facet values that should be returned for this facet. If unspecified, defaults to 20. The maximum allowed value is 300. Values above 300 are coerced to 300.

If this field is negative, an INVALID_ARGUMENT is returned.

excluded_filter_keys[]

string

List of keys to exclude when faceting.

By default, FacetKey.key is not excluded from the filter unless it is listed in this field.

Listing a facet key in this field allows its values to appear as facet results, even when they are filtered out of search results. Using this field does not affect what search results are returned.

For example, suppose there are 100 documents with the color facet "Red" and 200 documents with the color facet "Blue". A query containing the filter "color:ANY("Red")" and having "color" as FacetKey.key would by default return only "Red" documents in the search results, and also return "Red" with count 100 as the only color facet. Although there are also blue documents available, "Blue" would not be shown as an available facet value.

If "color" is listed in "excludedFilterKeys", then the query returns the facet values "Red" with count 100 and "Blue" with count 200, because the "color" key is now excluded from the filter. Because this field doesn't affect search results, the search results are still correctly filtered to return only "Red" documents.

A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error is returned.

enable_dynamic_position

bool

Enables dynamic position for this facet. If set to true, the position of this facet among all facets in the response is determined automatically. If dynamic facets are enabled, it is ordered together. If set to false, the position of this facet in the response is the same as in the request, and it is ranked before the facets with dynamic position enable and all dynamic facets.

For example, you may always want to have rating facet returned in the response, but it's not necessarily to always display the rating facet at the top. In that case, you can set enable_dynamic_position to true so that the position of rating facet in response is determined automatically.

Another example, assuming you have the following facets in the request:

  • "rating", enable_dynamic_position = true

  • "price", enable_dynamic_position = false

  • "brands", enable_dynamic_position = false

And also you have a dynamic facets enabled, which generates a facet gender. Then the final order of the facets in the response can be ("price", "brands", "rating", "gender") or ("price", "brands", "gender", "rating") depends on how API orders "gender" and "rating" facets. However, notice that "price" and "brands" are always ranked at first and second position because their enable_dynamic_position is false.

FacetKey

Specifies how a facet is computed.

Fields
key

string

Required. Supported textual and numerical facet keys in Document object, over which the facet values are computed. Facet key is case-sensitive.

intervals[]

Interval

Set only if values should be bucketed into intervals. Must be set for facets with numerical values. Must not be set for facet with text values. Maximum number of intervals is 30.

restricted_values[]

string

Only get facet for the given restricted values. Only supported on textual fields. For example, suppose "category" has three values "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set "restricted_values" to "Action > 2022", the "category" facet only contains "Action > 2022". Only supported on textual fields. Maximum is 10.

prefixes[]

string

Only get facet values that start with the given string prefix. For example, suppose "category" has three values "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the "category" facet only contains "Action > 2022" and "Action > 2021". Only supported on textual fields. Maximum is 10.

contains[]

string

Only get facet values that contains the given strings. For example, suppose "category" has three values "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the "category" facet only contains "Action > 2022" and "Sci-Fi > 2022". Only supported on textual fields. Maximum is 10.

case_insensitive

bool

True to make facet keys case insensitive when getting faceting values with prefixes or contains; false otherwise.

order_by

string

The order in which documents are returned.

Allowed values are:

If not set, textual values are sorted in natural order; numerical intervals are sorted in the order given by FacetSpec.FacetKey.intervals.

ImageQuery

Specifies the image query input.

Fields

Union field image.

image can be only one of the following:

image_bytes

string

Base64 encoded image bytes. Supported image formats: JPEG, PNG, and BMP.

QueryExpansionSpec

Specification to determine under which conditions query expansion should occur.

Fields
condition

Condition

The condition under which query expansion should occur. Default to Condition.DISABLED.

pin_unexpanded_results

bool

Whether to pin unexpanded results. If this field is set to true, unexpanded products are always at the top of the search results, followed by the expanded results.

Condition

Enum describing under which condition query expansion should occur.

Enums
CONDITION_UNSPECIFIED Unspecified query expansion condition. In this case, server behavior defaults to Condition.DISABLED.
DISABLED Disabled query expansion. Only the exact search query is used, even if SearchResponse.total_size is zero.
AUTO Automatic query expansion built by the Search API.

SpellCorrectionSpec

The specification for query spell correction.

Fields
mode

Mode

The mode under which spell correction should take effect to replace the original search query. Default to Mode.AUTO.

Mode

Enum describing under which mode spell correction should occur.

Enums
MODE_UNSPECIFIED Unspecified spell correction mode. In this case, server behavior defaults to Mode.AUTO.
SUGGESTION_ONLY Search API will try to find a spell suggestion if there is any and put in the SearchResponse.corrected_query. The spell suggestion will not be used as the search query.
AUTO Automatic spell correction built by the Search API. Search will be based on the corrected query if found.

SearchResponse

Response message for SearchService.Search method.

Fields
results[]

SearchResult

A list of matched documents. The order represents the ranking.

facets[]

Facet

Results of facets requested by user.

guided_search_result

GuidedSearchResult

Guided search result.

total_size

int32

The estimated total count of matched items irrespective of pagination. The count of results returned by pagination may be less than the total_size that matches.

attribution_token

string

A unique search token. This should be included in the UserEvent logs resulting from this search, which enables accurate attribution of search model performance.

redirect_uri

string

The URI of a customer-defined redirect page. If redirect action is triggered, no search is performed, and only redirect_uri and attribution_token are set in the response.

next_page_token

string

A token that can be sent as SearchRequest.page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

corrected_query

string

Contains the spell corrected query, if found. If the spell correction type is AUTOMATIC, then the search results are based on corrected_query. Otherwise the original query is used for search.

summary

Summary

A summary as part of the search results. This field is only returned if SearchRequest.ContentSearchSpec.summary_spec is set.

applied_controls[]

string

Controls applied as part of the Control service.

query_expansion_info

QueryExpansionInfo

Query expansion information for the returned results.

Facet

A facet result.

Fields
key

string

The key for this facet. E.g., "colors" or "price". It matches SearchRequest.FacetSpec.FacetKey.key.

values[]

FacetValue

The facet values for this field.

dynamic_facet

bool

Whether the facet is dynamically generated.

FacetValue

A facet value which contains value names and their count.

Fields
count

int64

Number of items that have this facet value.

Union field facet_value. A facet value which contains values. facet_value can be only one of the following:
value

string

Text value of a facet, such as "Black" for facet "colors".

interval

Interval

Interval value for a facet, such as [10, 20) for facet "price". It matches SearchRequest.FacetSpec.FacetKey.intervals.

GuidedSearchResult

Guided search result. The guided search helps user to refine the search results and narrow down to the real needs from a broaded search results.

Fields
refinement_attributes[]

RefinementAttribute

A list of ranked refinement attributes.

follow_up_questions[]

string

Suggested follow-up questions.

RefinementAttribute

Useful attribute for search result refinements.

Fields
attribute_key

string

Attribute key used to refine the results e.g. 'movie_type'.

attribute_value

string

Attribute value used to refine the results e.g. 'drama'.

QueryExpansionInfo

Information describing query expansion including whether expansion has occurred.

Fields
expanded_query

bool

Bool describing whether query expansion has occurred.

pinned_result_count

int64

Number of pinned results. This field will only be set when expansion happens and SearchRequest.QueryExpansionSpec.pin_unexpanded_results is set to true.

SearchResult

Represents the search results.

Fields
id

string

Document.id of the searched Document.

document

Document

The document data snippet in the search response. Only fields that are marked as retrievable are populated.

model_scores

map<string, DoubleList>

Google provided available scores.

Summary

Summary of the top N search result specified by the summary spec.

Fields
summary_text

string

The summary content.

summary_skipped_reasons[]

SummarySkippedReason

Additional summary-skipped reasons. This provides the reason for ignored cases. If nothing is skipped, this field is not set.

safety_attributes

SafetyAttributes

A collection of Safety Attribute categories and their associated confidence scores.

SafetyAttributes

Safety Attribute categories and their associated confidence scores.

Fields
categories[]

string

The display names of Safety Attribute categories associated with the generated content. Order matches the Scores.

scores[]

float

The confidence scores of the each category, higher value means higher confidence. Order matches the Categories.

SummarySkippedReason

An Enum for summary-skipped reasons.

Enums
SUMMARY_SKIPPED_REASON_UNSPECIFIED Default value. The summary skipped reason is not specified.
ADVERSARIAL_QUERY_IGNORED

The adversarial query ignored case.

Only populated when SummarySpec.ignore_adversarial_query is set to true.

NON_SUMMARY_SEEKING_QUERY_IGNORED

The non-summary seeking query ignored case.

Only populated when SummarySpec.ignore_non_summary_seeking_query is set to true.

OUT_OF_DOMAIN_QUERY_IGNORED

The out-of-domain query ignored case.

Google skips the summary if there are no high-relevance search results. For example, the data store contains facts about company A but the user query is asking questions about company B.

POTENTIAL_POLICY_VIOLATION

The potential policy violation case.

Google skips the summary if there is a potential policy violation detected. This includes content that may be violent or toxic.

LLM_ADDON_NOT_ENABLED

The LLM addon not enabled case.

Google skips the summary if the LLM addon is not enabled.

TextInput

Defines text input.

Fields
input

string

Text input.

context

ConversationContext

Conversation context of the input.

TransactionInfo

A transaction represents the entire purchase transaction.

Fields
currency

string

Required. Currency code. Use three-character ISO-4217 code.

transaction_id

string

The transaction ID with a length limit of 128 characters.

value

float

Required. Total non-zero value associated with the transaction. This value may include shipping, tax, or other adjustments to the total value that you want to include.

tax

float

All the taxes associated with the transaction.

cost

float

All the costs associated with the products. These can be manufacturing costs, shipping expenses not borne by the end user, or any other costs, such that:

discount_value

float

The total discount(s) value applied to this transaction. This figure should be excluded from TransactionInfo.value

For example, if a user paid TransactionInfo.value amount, then nominal (pre-discount) value of the transaction is the sum of TransactionInfo.value and TransactionInfo.discount_value

This means that profit is calculated the same way, regardless of the discount value, and that TransactionInfo.discount_value can be larger than TransactionInfo.value:

UpdateConversationRequest

Request for UpdateConversation method.

Fields
conversation

Conversation

Required. The Conversation to update.

update_mask

FieldMask

Indicates which fields in the provided Conversation to update. The following are NOT supported:

  • [conversation.name][]

If not set or empty, all supported fields are updated.

UpdateDocumentRequest

Request message for DocumentService.UpdateDocument method.

Fields
document

Document

Required. The document to update/create.

If the caller does not have permission to update the Document, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the Document to update does not exist and allow_missing is not set, a NOT_FOUND error is returned.

allow_missing

bool

If set to true, and the Document is not found, a new Document will be created.

UpdateSchemaMetadata

Metadata for UpdateSchema LRO.

Fields
create_time

Timestamp

Operation create time.

update_time

Timestamp

Operation last update time. If the operation is done, this is also the finish time.

UpdateSchemaRequest

Request message for SchemaService.UpdateSchema method.

Fields
schema

Schema

Required. The Schema to update.

allow_missing

bool

If set to true, and the Schema is not found, a new Schema will be created. In this situation, update_mask is ignored.

UserEvent

UserEvent captures all metadata information Discovery Engine API needs to know about how end users interact with customers' website.

Fields
event_type

string

Required. User event type. Allowed values are:

Generic values:

  • search: Search for Documents.
  • view-item: Detailed page view of a Document.
  • view-item-list: View of a panel or ordered list of Documents.
  • view-home-page: View of the home page.
  • view-category-page: View of a category page, e.g. Home > Men > Jeans

Retail-related values:

  • add-to-cart: Add an item(s) to cart, e.g. in Retail online shopping
  • purchase: Purchase an item(s)

Media-related values:

  • media-play: Start/resume watching a video, playing a song, etc.
  • media-complete: Finished or stopped midway through a video, song, etc.
user_pseudo_id

string

Required. 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 log in/out of the website.

Do not set the field to the same fixed ID for different users. This mixes the event history of those users together, which results in degraded model quality.

The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

The field should not contain PII or user-data. We recommend to use Google Analytics Client ID for this field.

event_time

Timestamp

Only required for UserEventService.ImportUserEvents method. Timestamp of when the user event happened.

user_info

UserInfo

Information about the end user.

direct_user_request

bool

Should set to true if the request is made directly from the end user, in which case the UserEvent.user_info.user_agent can be populated from the HTTP request.

This flag should be set only if the API request is made directly from the end user such as a mobile app (and not if a gateway or a server is processing and pushing the user events).

This should not be set when using the JavaScript tag in UserEventService.CollectUserEvent.

session_id

string

A unique identifier for tracking a visitor session with a length limit of 128 bytes. A session is an aggregation of an end user behavior in a time span.

A general guideline to populate the session_id:

  1. If user has no activity for 30 min, a new session_id should be assigned.
  2. The session_id should be unique across users, suggest use uuid or add UserEvent.user_pseudo_id as prefix.
page_info

PageInfo

Page metadata such as categories and other critical information for certain event types such as view-category-page.

attribution_token

string

Token to attribute an API response to user action(s) to trigger the event.

Highly recommended for user events that are the result of RecommendationService.Recommend. This field enables accurate attribution of recommendation model performance.

The value must be one of:

This token enables us to accurately attribute page view or conversion completion back to the event and the particular predict response containing this clicked/purchased product. If user clicks on product K in the recommendation results, pass RecommendResponse.attribution_token as a URL parameter to product K's page. When recording events on product K's page, log the RecommendResponse.attribution_token to this field.

filter

string

The filter syntax consists of an expression language for constructing a predicate from one or more fields of the documents being filtered.

One example is for search events, the associated SearchRequest may contain a filter expression in SearchRequest.filter conforming to https://google.aip.dev/160#filtering.

Similarly, for view-item-list events that are generated from a [RecommendationService.RecommendRequest][], this field may be populated directly from [RecommendationService.RecommendRequest.filter][] conforming to https://google.aip.dev/160#filtering.

The value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

documents[]

DocumentInfo

List of Documents associated with this user event.

This field is optional except for the following event types:

  • view-item
  • add-to-cart
  • purchase
  • media-play
  • media-complete

In a search event, this field represents the documents returned to the end user on the current page (the end user may have not finished browsing the whole page yet). When a new page is returned to the end user, after pagination/filtering/ordering even for the same query, a new search event with different UserEvent.documents is desired.

panel

PanelInfo

Panel metadata associated with this user event.

search_info

SearchInfo

SearchService.Search details related to the event.

This field should be set for search event.

completion_info

CompletionInfo

CompletionService.CompleteQuery details related to the event.

This field should be set for search event when autocomplete function is enabled and the user clicks a suggestion for search.

transaction_info

TransactionInfo

The transaction metadata (if any) associated with this user event.

tag_ids[]

string

A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups on the customer end.

promotion_ids[]

string

The promotion IDs if this is an event associated with promotions. Currently, this field is restricted to at most one ID.

attributes

map<string, CustomAttribute>

Extra user event features to include in the recommendation model. These attributes must NOT contain data that needs to be parsed or processed further, e.g. JSON or other encodings.

If you provide custom attributes for ingested user events, also include them in the user events that you associate with prediction requests. Custom attribute formatting must be consistent between imported events and events provided with prediction requests. This lets the Discovery Engine API use those custom attributes when training models and serving predictions, which helps improve recommendation quality.

This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT error is returned:

  • The key must be a UTF-8 encoded string with a length limit of 5,000 characters.
  • For text attributes, at most 400 values are allowed. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 256 characters.
  • For number attributes, at most 400 values are allowed.

For product recommendations, an example of extra user information is traffic_channel, which is how a user arrives at the site. Users can arrive at the site by coming to the site directly, coming through Google search, or in other ways.

media_info

MediaInfo

Media-specific info.

UserInfo

Information of an end user.

Fields
user_id

string

Highly recommended for logged-in users. Unique identifier for logged-in user, such as a user name. Don't set for anonymous users.

Always use a hashed value for this ID.

Don't set the field to the same fixed ID for different users. This mixes the event history of those users together, which results in degraded model quality.

The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

user_agent

string

User agent as included in the HTTP header.

The field must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

This should not be set when using the client side event reporting with GTM or JavaScript tag in UserEventService.CollectUserEvent or if UserEvent.direct_user_request is set.

WriteUserEventRequest

Request message for WriteUserEvent method.

Fields
parent

string

Required. The parent DataStore resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}.

user_event

UserEvent

Required. User event to write.