What is Metadata?

Overview

Metadata is information that describes your data - essentially “data about data”. Just as a book has a table of contents to help you understand its structure, metadata provides context about your data’s content, origin, purpose, etc., making it easier for you to find and manage information in your knowledge base.

This guide aims to help you understand metadata and effectively manage your knowledge base.

Core Concepts

  • Field: The label of a metadata field (e.g., “author”, “language”).

  • Value: The information stored in a metadata field (e.g., “Jack”, “English”).

  • Value Count: The number of values contained in a metadata field,including duplicates. (e.g., “3”).
  • Value Type: The type of value a field can contain.
    • Dify supports three value types:
      • String: For text-based information
      • Number: For numerical data
      • Time: For dates/timestamps

How to Manage My Metadata?

Manage Metadata Fields in the Knowledge Base

You can create, modify, and delete metadata fields in the knowledge base.

Any changes you make to metadata fields here affect your knowledge base globally.

Get Started with the Metadata Panel

Access the Metadata Panel

To access the Metadata Panel, go to Knowledge Base page and click Metadata.

Built-in vs Custom Metadata

Built-in MetadataCustom Metadata
LocationLower section of the Metadata panelUpper section of the Metadata panel
ActivationDisabled by default; requires manual activationAdd as needed
GenerationSystem automatically extracts and generates field valuesUser-defined and manually added
EditingFields and values cannot be modified once generatedFields and values can be edited or deleted
ScopeApplies to all existing and new documents when enabledStored in metadata list; requires manual assignment to documents
Fields

System-defined fields include:

  • document_name (string)
  • uploader (string)
  • upload_date (time)
  • last_update_date (time)
  • source (string)
No default fields; all fields must be manually created
Value Types
  • String: For text values
  • Number: For numerical values
  • Time: For dates and timestamps
  • String: For text values
  • Number: For numerical values
  • Time: For dates and timestamps

Create New Metadata Fields

To create a new metadata field:

  1. Click +Add Metadata to open the New Metadata dialog.

  1. Choose the value type.

  2. Name the field.

Naming rules: Use lowercase letters, numbers, and underscores only.

  1. Click Save to apply changes.

Edit Metadata Fields

To edit a metadata field:

  1. Click the edit icon next to a field to open the Rename dialog.

  1. Enter the new name in the Name field.

Note: You can only modify the field name, not the value type.

  1. Click Save to apply changes.

Note: Field changes update across all related documents in your knowledge base.

Delete Metadata Fields

To delete a metadata field, click the delete icon next to a field to delete it.

Note: Deleting a field deletes it and all its values from all documents in your knowledge base.

Edit Metadata

Bulk Edit Metadata in the Metadata Editor

You can edit metadata in bulk in the knowledge base.

Access the Metadata Editor

To access the Metadata Editor:

  1. In the knowledge base, select documents using the checkboxes on the left.

  1. Click Metadata in the bottom action bar to open the Metadata Editor.

Bulk Add Metadata

To add metadata in bulk:

  1. Click +Add Metadata in the editor to:
  • Add existing fields from the dropdown or from the search box.
  • Create new fields via +New Metadata.

    New fields are automatically added to the knowledge base.

  • Access the Metadata Panel to manage metadata fields via Manage.
  1. (Optional) Enter values for new fields.

The date picker is for time-type fields.

  1. Click Save to apply changes.

Bulk Update Metadata

To update metadata in bulk:

  1. In the editor:
  • Add Values: Type directly in the field boxes.

  • Reset Values: Click the blue dot that appears on hover.

  • Delete Values: Clear the field or delete the Multiple Value card.
  • Delete fields: Click the delete icon (fields appear struck through and grayed out).

    Note: This only deletes the field from this document, not from your knowledge base.

  1. Click Save to apply changes.

Set Update Scope

Use Apply to All Documents to control changes:

  • Unchecked (Default): Updates only documents that already have the field.

  • Checked: Adds or updates fields across all selected documents.

Edit Metadata on the Document Details Page

You can edit a single document’s metadata on its details page.

Access Metadata Edit Mode

To edit a single document’s metadata:

On the document details page, click Start labeling to begin editing.

Add Metadata

To add a single document’s metadata fields and values:

  1. Click +Add Metadata to:

    • Create new fields via +New Metadata.

    New fields are automatically added to the knowledge base.

    • Add existing fields from the dropdown or from the search box.

    • Access the Metadata Panel via Manage.

  2. (Optional) Enter values for new fields.

  1. Click Save to apply changes.

Edit Metadata

To update a single document’s metadata fields and values:

  1. Click Edit in the top right to begin editing.

  1. Edit metadata:

    • Update Values: Type directly in value fields or delete it.

    Note: You can only modify the value, not the value name.

    • Delete Fields: Click the delete icon.

    Note: This only deletes the field from this document, not from your knowledge base.

  1. Click Save to apply changes.

How to Filter Documents with Metadata?

See Metadata Filtering in Integrate Knowledge Base within Application.

API Documentation

See Maintaining Dataset via API.

FAQ

  • What can I do with metadata?

    • Find information faster with smart filtering.

    • Control access to sensitive content.

    • Organize data more effectively.

    • Automate workflows based on metadata rules.

  • Fields vs Values: What is the difference?

DefinitionCharacteristicsExamples
Metadata Fields in the Metadata PanelSystem-defined attributes that describe document propertiesGlobal fields accessible across all documents in the knowledge baseAuthor, Type, Date, etc.
Metadata Value on a document’s detail pageCustom metadata tagged according to individual document requirementsUnique metadata values assigned based on document content and contextThe “Author” field in Document A is set to “Mary” value, while in Document B it is set to “John” value.
  • How do different delete options work?
ActionStepsImpactOutcome
Delete field in the Metadata PanelIn the Metadata Panel, click delete icon next to fieldGlobal - affects all documentsField and all values permanently deleted from the knowledge base
Delete field in the Metadata EditorIn the Metadata Editor, click delete icon next to fieldSelected documents onlyField deleted from selected documents; remains in the knowledge base
Delete field on the document detail pageIn the Edit Mode, click delete icon next to fieldCurrent document onlyField deleted from current document; remains in the knowledge base