# Tags and filtering (/knowledgebase/tags)



Tags attach structured metadata to documents. Use them to select a department, date range, priority, or status before retrieving chunks.

A **tag definition** belongs to the knowledge base and gives a tag its name and type. A **tag value** belongs to a document. For example, define a Text tag named `Department`, then set `Department = "engineering"` on the documents that need it.

## Types and capacity [#types-and-capacity]

Each knowledge base has **17 tag slots**, shared by its documents and connectors:

| Type | Slots | Values |
| - | - | - |
| Text | 7 | Strings up to 512 characters; matching is case-insensitive. |
| Number | 5 | Valid numbers. |
| Date | 2 | Valid dates in `YYYY-MM-DD` format. |
| Boolean | 3 | `true` or `false`. |

The type picker shows usage, such as &#x2A;*Text (0/7)**, and only offers types with available slots. A connector's metadata tags use the same pool; choose the metadata you need during [connector setup](/knowledgebase/connectors).

## Define and manage tags [#define-and-manage-tags]

You need workspace write access to create or delete definitions.

1. Click the knowledge base name in the header and choose **Tags**.
2. Choose **Add Tag**.
3. Enter a **Tag Name**, choose a **Type**, and select **Create Tag**. Press Enter to submit or Escape to cancel.

Names can be up to 100 characters and must be unique within the base, ignoring case. The Tags modal shows each definition's document count. Click a definition to view the documents with assigned values.

The modal supports creating and deleting definitions. To rename a definition without clearing its values, use [Update knowledge tag](/api-reference/knowledge-bases/updateKnowledgeTag) in the API.

Deleting a definition clears its values from every document and chunk that uses the slot. The confirmation dialog shows the affected documents. Review this consequence before selecting the trash icon and confirming.

## Set document values [#set-document-values]

Right-click a document and choose **Tags**. Set the values for its defined tags in the document's tag panel.

The **Tags** column shows assigned values; documents without values show dashes. Use **Filter** to narrow the document list by tag values.

## Filter a workflow search [#filter-a-workflow-search]

Open the Knowledge block and add **Tag Filters**. Each filter has:

* **Tag** — a definition from the selected base.
* **Operator** — a comparison supported by that type.
* **Value** — a fixed value or a workflow reference, such as `<start.department>`.

For example, use `Department equals "engineering"` with a query about incident handling. The filter restricts candidate documents, and the query retrieves relevant chunks within them.

Add filters with the &#x2A;*+** button. Filters combine with AND, including filters on the same tag; a document must match every condition. A document without the required tag value will not match a comparison.

### Operators [#operators]

| Type | UI operators |
| - | - |
| Text | **equals**, **not equals**, **contains**, **does not contain**, **starts with**, **ends with** |
| Number | **equals**, **not equals**, **greater than**, **greater than or equal**, **less than**, **less than or equal**, **between** |
| Date | **equals**, **after**, **on or after**, **before**, **on or before**, **between** |
| Boolean | **is**, **is not** |

**between** takes a lower and upper value and includes both bounds. Date comparisons apply to the specified calendar days. Text operators match literal text without case sensitivity.

### Query and tags [#query-and-tags]

| Input | Behavior |
| - | - |
| Tags only | Return matching chunks up to **Number of Results**, without vector ranking. Each match has `similarity: 1`. |
| Query only | Retrieve from readable documents using the selected retrieval mode. |
| Query and tags | Filter documents first, then retrieve within the matching set. |

Tag-only retrieval does not generate a query embedding. Adding tags to a query narrows candidates but does not reduce the query-embedding charge. See [Using a knowledge base in a workflow](/knowledgebase/using-in-workflows) for retrieval modes and output fields.

## Connector metadata [#connector-metadata]

Connectors can define and populate tags from source metadata. Notion can set **Labels** and **Last Modified**; GitHub can set **Repository** and **File Path**. You can use these definitions in the same filters as manual tags.

Metadata checkboxes are available during connector setup. Uncheck fields you do not need before connecting. Compatible existing definitions can be reused; new definitions consume available slots. Existing definitions retain their slots until deleted. The connector's Settings tab does not offer a metadata-tag editor, and changing source configuration does not automatically free tag slots.

## Related docs [#related-docs]

* [Connectors](/knowledgebase/connectors) — select source metadata during setup.
* [Using a knowledge base in a workflow](/knowledgebase/using-in-workflows) — combine query and tag inputs.
* [Debugging retrieval](/knowledgebase/debugging-retrieval) — diagnose filters that exclude expected results.
