Skip to main content
Version: 2.0

Using Metadata

To effectively use metadata filters in Vectara, you need to configure the metadata fields that your queries can filter on. This process involves creating or updating metadata attributes during corpus setup or for an existing corpus.

This section explains how to create or add metadata filters and provides helpful context for planning and implementing metadata fields. Let's look at the ways to create and add metadata filters to your corpus data.

Add metadata during corpus creation

When creating a corpus with the Vectara Console or the Create Corpus API, you define metadata fields using the filter_attributes object. This ensures the corpus supports filtering on specific metadata attributes, either at the document level or the part level.

API Endpoint: POST https://api.vectara.io/v2/corpora

Upload documents with metadata

Metadata can also be added while uploading documents to the corpus. Specify this in the metadata field of the multipart request. For more information about the request details, see File Upload API Definition. For more information about how to structure your documents, see Document Data Structuring.

API Endpoint: POST https://api.vectara.io/v2/corpora/:corpus_key/upload_file

Update or replace metadata for an existing corpus

To update or replace metadata fields for documents in an existing corpus, use the following APIs:

API Endpoints:

Note

Updating or replacing metadata is limited only to document-level metadata.