Skip to main content

documents

Creates, updates, deletes, gets or lists a documents resource.

Overview

Namedocuments
TypeResource
Idgemini.file_search_stores.documents

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringImmutable. Identifier. The `Document` resource name. The ID (name excluding the "fileSearchStores/*/documents/" prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be derived from `display_name` along with a 12 character random suffix. Example: `fileSearchStores/{file_search_store_id}/documents/my-awesome-doc-123a456b789c`
createTimestring (google-datetime)Output only. The Timestamp of when the `Document` was created.
customMetadataarrayOptional. User provided custom metadata stored as key-value pairs used for querying. A `Document` can have a maximum of 20 `CustomMetadata`.
displayNamestringOptional. The human-readable display name for the `Document`. The display name must be no more than 512 characters in length, including spaces. Example: "Semantic Retriever Documentation"
mimeTypestringOutput only. The mime type of the Document.
sizeBytesstring (int64)Output only. The size of raw bytes ingested into the Document.
statestringOutput only. Current state of the `Document`. (STATE_UNSPECIFIED, STATE_PENDING, STATE_ACTIVE, STATE_FAILED)
updateTimestring (google-datetime)Output only. The Timestamp of when the `Document` was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectfileSearchStoresId, documentsIdGets information about a specific Document.
listselectfileSearchStoresIdLists all Documents in a Corpus.
deletedeletefileSearchStoresId, documentsIdforceDeletes a Document.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
documentsIdstring
fileSearchStoresIdstring
forcebooleanOptional. If set to true, any Chunks and objects related to this Document will also be deleted. If false (the default), a FAILED_PRECONDITION error will be returned if Document contains any Chunks.

SELECT examples

Gets information about a specific Document.

SELECT
name,
createTime,
customMetadata,
displayName,
mimeType,
sizeBytes,
state,
updateTime
FROM gemini.file_search_stores.documents
WHERE fileSearchStoresId = '{{ fileSearchStoresId }}' -- required
AND documentsId = '{{ documentsId }}' -- required
;

DELETE examples

Deletes a Document.

DELETE FROM gemini.file_search_stores.documents
WHERE fileSearchStoresId = '{{ fileSearchStoresId }}' --required
AND documentsId = '{{ documentsId }}' --required
AND force = '{{ force }}'
;