Skip to main content

documents

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

Overview

Namedocuments
TypeResource
Idgoogle.discoveryengine.documents

Fields

NameDatatypeDescription
idstringImmutable. The identifier of the document. Id should conform to RFC-1034 standard with a length limit of 63 characters.
namestringImmutable. 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.
contentobjectUnstructured data linked to this document.
derivedStructDataobjectOutput only. This field is OUTPUT_ONLY. It contains derived data that are not in the original input document.
indexStatusobjectIndex status of the document.
indexTimestringOutput only. The last time the document was indexed. If this field is set, the document could be returned in search results. This field is OUTPUT_ONLY. If this field is not populated, it means the document has never been indexed.
jsonDatastringThe JSON string representation of the document. It should conform to the registered Schema or an INVALID_ARGUMENT error is thrown.
parentDocumentIdstringThe 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.
schemaIdstringThe identifier of the schema located in the same data store.
structDataobjectThe structured JSON data for the document. It should conform to the registered Schema or an INVALID_ARGUMENT error is thrown.

Methods

NameAccessible byRequired ParamsDescription
projects_locations_collections_data_stores_branches_documents_getSELECTbranchesId, collectionsId, dataStoresId, documentsId, locationsId, projectsIdGets a Document.
projects_locations_collections_data_stores_branches_documents_listSELECTbranchesId, collectionsId, dataStoresId, locationsId, projectsIdGets a list of Documents.
projects_locations_data_stores_branches_documents_getSELECTbranchesId, dataStoresId, documentsId, locationsId, projectsIdGets a Document.
projects_locations_data_stores_branches_documents_listSELECTbranchesId, dataStoresId, locationsId, projectsIdGets a list of Documents.
projects_locations_collections_data_stores_branches_documents_createINSERTbranchesId, collectionsId, dataStoresId, locationsId, projectsIdCreates a Document.
projects_locations_data_stores_branches_documents_createINSERTbranchesId, dataStoresId, locationsId, projectsIdCreates a Document.
projects_locations_collections_data_stores_branches_documents_deleteDELETEbranchesId, collectionsId, dataStoresId, documentsId, locationsId, projectsIdDeletes a Document.
projects_locations_data_stores_branches_documents_deleteDELETEbranchesId, dataStoresId, documentsId, locationsId, projectsIdDeletes a Document.
projects_locations_collections_data_stores_branches_documents_patchUPDATEbranchesId, collectionsId, dataStoresId, documentsId, locationsId, projectsIdUpdates a Document.
projects_locations_data_stores_branches_documents_patchUPDATEbranchesId, dataStoresId, documentsId, locationsId, projectsIdUpdates a Document.
projects_locations_collections_data_stores_branches_documents_importEXECbranchesId, collectionsId, dataStoresId, locationsId, projectsIdBulk import of multiple Documents. Request processing may be synchronous. Non-existing items are created. Note: It is possible for a subset of the Documents to be successfully updated.
projects_locations_collections_data_stores_branches_documents_purgeEXECbranchesId, collectionsId, dataStoresId, locationsId, projectsIdPermanently 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.
projects_locations_data_stores_branches_documents_importEXECbranchesId, dataStoresId, locationsId, projectsIdBulk import of multiple Documents. Request processing may be synchronous. Non-existing items are created. Note: It is possible for a subset of the Documents to be successfully updated.
projects_locations_data_stores_branches_documents_purgeEXECbranchesId, dataStoresId, locationsId, projectsIdPermanently 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.

SELECT examples

Gets a list of Documents.

SELECT
id,
name,
content,
derivedStructData,
indexStatus,
indexTime,
jsonData,
parentDocumentId,
schemaId,
structData
FROM google.discoveryengine.documents
WHERE branchesId = '{{ branchesId }}'
AND dataStoresId = '{{ dataStoresId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new documents resource.

/*+ create */
INSERT INTO google.discoveryengine.documents (
branchesId,
dataStoresId,
locationsId,
projectsId,
structData,
jsonData,
name,
schemaId,
content,
parentDocumentId
)
SELECT
'{{ branchesId }}',
'{{ dataStoresId }}',
'{{ locationsId }}',
'{{ projectsId }}',
'{{ structData }}',
'{{ jsonData }}',
'{{ name }}',
'{{ schemaId }}',
'{{ content }}',
'{{ parentDocumentId }}'
;

UPDATE example

Updates a documents resource.

/*+ update */
UPDATE google.discoveryengine.documents
SET
structData = '{{ structData }}',
jsonData = '{{ jsonData }}',
name = '{{ name }}',
schemaId = '{{ schemaId }}',
content = '{{ content }}',
parentDocumentId = '{{ parentDocumentId }}'
WHERE
branchesId = '{{ branchesId }}'
AND dataStoresId = '{{ dataStoresId }}'
AND documentsId = '{{ documentsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

DELETE example

Deletes the specified documents resource.

/*+ delete */
DELETE FROM google.discoveryengine.documents
WHERE branchesId = '{{ branchesId }}'
AND dataStoresId = '{{ dataStoresId }}'
AND documentsId = '{{ documentsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';