REST Resource: projects.locations.collections.dataStores.branches.documents

Resource: Document

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

JSON representation
{
  "name": string,
  "id": string,
  "schemaId": string,
  "content": {
    object (Content)
  },
  "parentDocumentId": string,
  "derivedStructData": {
    object
  },

  // Union field data can be only one of the following:
  "structData": {
    object
  },
  "jsonData": string
  // End of list of possible types for union field data.
}
Fields
name

string

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

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.

schemaId

string

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

content

object (Content)

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

parentDocumentId

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.

derivedStructData

object (Struct format)

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:
structData

object (Struct format)

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

jsonData

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.

JSON representation
{
  "mimeType": string,

  // Union field content can be only one of the following:
  "rawBytes": string,
  "uri": string
  // End of list of possible types for union field content.
}
Fields
mimeType

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:

rawBytes

string (bytes format)

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.

A base64-encoded string.

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.

Methods

create

Creates a Document.

delete

Deletes a Document.

get

Gets a Document.

import

Bulk import of multiple Documents.

list

Gets a list of Documents.

patch

Updates a Document.

purge

Permanently deletes all selected Documents in a branch.