INTEGRITY Cloudflare Docs

Metadata filter (legacy)

This page documents the filter format used by the legacy AutoRAG REST API. For the new AI Search REST API filter syntax, refer to Metadata filtering.

Comparison filter

Compare a metadata attribute (for example, folder or timestamp) with a target value:

filters: {
  type: "eq",
  key: "folder",
  value: "customer-a/"
}

Operators

Operator Description
eq Equals
ne Not equals
gt Greater than
gte Greater than or equal to
lt Less than
lte Less than or equal to

Compound filter

Combine multiple comparison filters with a logical operator:

filters: {
  type: "and",
  filters: [
    { type: "eq", key: "folder", value: "customer-a/" },
    { type: "gte", key: "timestamp", value: "1735689600000" }
  ]
}

The available compound operators are and and or.

Limitations

"Starts with" filter for folders

To filter for all files within a folder and its subfolders, use a compound filter with range operators.

For example, consider this file structure:

Using { type: "eq", key: "folder", value: "customer-a/" } only matches files directly in that folder (like profile.md), not files in subfolders.

To match all files starting with customer-a/, use a compound filter:

filters: {
  type: "and",
  filters: [
    { type: "gt", key: "folder", value: "customer-a//" },
    { type: "lte", key: "folder", value: "customer-a/z" }
  ]
}

This filter matches all paths starting with customer-a/ by using: