documents
Creates, updates, deletes, gets or lists a documents resource.
Overview
| Name | documents |
| Type | Resource |
| Id | gemini.file_search_stores.documents |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
name | string | Immutable. 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` |
createTime | string (google-datetime) | Output only. The Timestamp of when the `Document` was created. |
customMetadata | array | Optional. User provided custom metadata stored as key-value pairs used for querying. A `Document` can have a maximum of 20 `CustomMetadata`. |
displayName | string | Optional. 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" |
mimeType | string | Output only. The mime type of the Document. |
sizeBytes | string (int64) | Output only. The size of raw bytes ingested into the Document. |
state | string | Output only. Current state of the `Document`. (STATE_UNSPECIFIED, STATE_PENDING, STATE_ACTIVE, STATE_FAILED) |
updateTime | string (google-datetime) | Output only. The Timestamp of when the `Document` was last updated. |
| Name | Datatype | Description |
|---|---|---|
name | string | Immutable. 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` |
createTime | string (google-datetime) | Output only. The Timestamp of when the `Document` was created. |
customMetadata | array | Optional. User provided custom metadata stored as key-value pairs used for querying. A `Document` can have a maximum of 20 `CustomMetadata`. |
displayName | string | Optional. 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" |
mimeType | string | Output only. The mime type of the Document. |
sizeBytes | string (int64) | Output only. The size of raw bytes ingested into the Document. |
state | string | Output only. Current state of the `Document`. (STATE_UNSPECIFIED, STATE_PENDING, STATE_ACTIVE, STATE_FAILED) |
updateTime | string (google-datetime) | Output only. The Timestamp of when the `Document` was last updated. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | fileSearchStoresId, documentsId | Gets information about a specific Document. | |
list | select | fileSearchStoresId | Lists all Documents in a Corpus. | |
delete | delete | fileSearchStoresId, documentsId | force | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
documentsId | string | |
fileSearchStoresId | string | |
force | boolean | Optional. 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
- get
- list
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
;
Lists all Documents in a Corpus.
SELECT
name,
createTime,
customMetadata,
displayName,
mimeType,
sizeBytes,
state,
updateTime
FROM gemini.file_search_stores.documents
WHERE fileSearchStoresId = '{{ fileSearchStoresId }}' -- required
;
DELETE examples
- delete
Deletes a Document.
DELETE FROM gemini.file_search_stores.documents
WHERE fileSearchStoresId = '{{ fileSearchStoresId }}' --required
AND documentsId = '{{ documentsId }}' --required
AND force = '{{ force }}'
;