Skip to main content

documents

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

Overview

Namedocuments
TypeResource
Idgoogle.discoveryengine.documents

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idstringImmutable. The identifier of the document. Id should conform to RFC-1034 standard with a length limit of 128 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.
aclInfoobjectAccess control information for the document. (id: GoogleCloudDiscoveryengineV1DocumentAclInfo)
contentobjectThe unstructured data linked to this document. Content can only be set and must be set if this document is under a CONTENT_REQUIRED data store. (id: GoogleCloudDiscoveryengineV1DocumentContent)
derivedStructDataobjectOutput only. This field is OUTPUT_ONLY. It contains derived data that are not in the original input document.
indexStatusobjectOutput only. The index status of the document. * If document is indexed successfully, the index_time field is populated. * Otherwise, if document is not indexed due to errors, the error_samples field is populated. * Otherwise, if document's index is in progress, the pending_message field is populated. (id: GoogleCloudDiscoveryengineV1DocumentIndexStatus)
indexTimestring (google-datetime)Output 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

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_locations_collections_data_stores_branches_documents_getselectprojectsId, locationsId, collectionsId, dataStoresId, branchesId, documentsIdGets a Document.
projects_locations_collections_data_stores_branches_documents_listselectprojectsId, locationsId, collectionsId, dataStoresId, branchesIdpageSize, pageTokenGets a list of Documents.
projects_locations_data_stores_branches_documents_getselectprojectsId, locationsId, dataStoresId, branchesId, documentsIdGets a Document.
projects_locations_data_stores_branches_documents_listselectprojectsId, locationsId, dataStoresId, branchesIdpageSize, pageTokenGets a list of Documents.
projects_locations_collections_data_stores_branches_documents_createinsertprojectsId, locationsId, collectionsId, dataStoresId, branchesIddocumentIdCreates a Document.
projects_locations_data_stores_branches_documents_createinsertprojectsId, locationsId, dataStoresId, branchesIddocumentIdCreates a Document.
projects_locations_collections_data_stores_branches_documents_patchupdateprojectsId, locationsId, collectionsId, dataStoresId, branchesId, documentsIdallowMissing, updateMaskUpdates a Document.
projects_locations_data_stores_branches_documents_patchupdateprojectsId, locationsId, dataStoresId, branchesId, documentsIdallowMissing, updateMaskUpdates a Document.
projects_locations_collections_data_stores_branches_documents_deletedeleteprojectsId, locationsId, collectionsId, dataStoresId, branchesId, documentsIdDeletes a Document.
projects_locations_data_stores_branches_documents_deletedeleteprojectsId, locationsId, dataStoresId, branchesId, documentsIdDeletes a Document.
projects_locations_collections_data_stores_branches_documents_importexecprojectsId, locationsId, collectionsId, dataStoresId, branchesIdBulk 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_purgeexecprojectsId, locationsId, collectionsId, dataStoresId, branchesIdPermanently 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_importexecprojectsId, locationsId, dataStoresId, branchesIdBulk 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_purgeexecprojectsId, locationsId, dataStoresId, branchesIdPermanently 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.

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
branchesIdstring
collectionsIdstring
dataStoresIdstring
documentsIdstring
locationsIdstring
projectsIdstring
allowMissingboolean
documentIdstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets a Document.

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

INSERT examples

Creates a Document.

INSERT INTO google.discoveryengine.documents (
data__structData,
data__jsonData,
data__name,
data__id,
data__schemaId,
data__content,
data__parentDocumentId,
data__aclInfo,
projectsId,
locationsId,
collectionsId,
dataStoresId,
branchesId,
documentId
)
SELECT
'{{ structData }}',
'{{ jsonData }}',
'{{ name }}',
'{{ id }}',
'{{ schemaId }}',
'{{ content }}',
'{{ parentDocumentId }}',
'{{ aclInfo }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ collectionsId }}',
'{{ dataStoresId }}',
'{{ branchesId }}',
'{{ documentId }}'
RETURNING
id,
name,
aclInfo,
content,
derivedStructData,
indexStatus,
indexTime,
jsonData,
parentDocumentId,
schemaId,
structData
;

UPDATE examples

Updates a Document.

UPDATE google.discoveryengine.documents
SET
data__structData = '{{ structData }}',
data__jsonData = '{{ jsonData }}',
data__name = '{{ name }}',
data__id = '{{ id }}',
data__schemaId = '{{ schemaId }}',
data__content = '{{ content }}',
data__parentDocumentId = '{{ parentDocumentId }}',
data__aclInfo = '{{ aclInfo }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND collectionsId = '{{ collectionsId }}' --required
AND dataStoresId = '{{ dataStoresId }}' --required
AND branchesId = '{{ branchesId }}' --required
AND documentsId = '{{ documentsId }}' --required
AND allowMissing = {{ allowMissing}}
AND updateMask = '{{ updateMask}}'
RETURNING
id,
name,
aclInfo,
content,
derivedStructData,
indexStatus,
indexTime,
jsonData,
parentDocumentId,
schemaId,
structData;

DELETE examples

Deletes a Document.

DELETE FROM google.discoveryengine.documents
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND collectionsId = '{{ collectionsId }}' --required
AND dataStoresId = '{{ dataStoresId }}' --required
AND branchesId = '{{ branchesId }}' --required
AND documentsId = '{{ documentsId }}' --required;

Lifecycle Methods

Bulk 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.

EXEC google.discoveryengine.documents.projects_locations_collections_data_stores_branches_documents_import 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@collectionsId='{{ collectionsId }}' --required,
@dataStoresId='{{ dataStoresId }}' --required,
@branchesId='{{ branchesId }}' --required
@@json=
'{
"inlineSource": "{{ inlineSource }}",
"gcsSource": "{{ gcsSource }}",
"bigquerySource": "{{ bigquerySource }}",
"fhirStoreSource": "{{ fhirStoreSource }}",
"spannerSource": "{{ spannerSource }}",
"cloudSqlSource": "{{ cloudSqlSource }}",
"firestoreSource": "{{ firestoreSource }}",
"alloyDbSource": "{{ alloyDbSource }}",
"bigtableSource": "{{ bigtableSource }}",
"errorConfig": "{{ errorConfig }}",
"reconciliationMode": "{{ reconciliationMode }}",
"updateMask": "{{ updateMask }}",
"autoGenerateIds": {{ autoGenerateIds }},
"idField": "{{ idField }}",
"forceRefreshContent": {{ forceRefreshContent }}
}';