Skip to main content

Querying

Once metadata is attached to documents, it becomes available for search and retrieval through the standard Client API.

Each metadata key becomes a search facet of the form <groupName><keyName>. For example, given a group address with key country, this query returns documents tagged with USA:

addresscountry:USA

Facets follow standard Glean operator syntax and can be combined with other operators, including those produced by Custom Properties.

When skipIndexing is false (the default), metadata values participate in full-text search. A document tagged with status: Approved matches a free-text query for Approved.

Setting skipIndexing: true keeps the value retrievable on the document but excludes it from full-text matching — useful for internal-only fields you don't want surfacing through generic queries.

Fetching metadata via Get Documents

Use the Client API getDocuments endpoint to fetch all metadata attached to a document:

{
"ids": ["gdrive_abc123"],
"includeFields": ["CUSTOM_METADATA"]
}

Custom metadata is returned in Document.metadata.customData, alongside any datasource-native metadata fields (such as author).

Co-existence with Custom Properties

A document can have both Custom Properties and Custom Metadata simultaneously. They appear alongside each other in faceted search and getDocuments responses, with independent lifecycles — re-indexing a document via the Indexing API does not affect its Custom Metadata. See Custom Properties vs Custom Metadata for a full comparison.