Metadata & Filtering
Metadata is arbitrary key-value data you attach to each document at ingest time. Design your schema before you start ingesting — it determines how precisely you can scope queries later.
Attaching metadata at ingest
Any JSON object is valid. Use keys that reflect how you want to filter — by department, client, document type, date, or any dimension that matters to your application.
All metadata values must be strings. If you store numbers or booleans, convert them to strings before ingest: "year": "2024" not "year": 2024.
Filtering at query time
Pass a filters object to POST /v1/query. Filters use AND logic — all specified keys must match. Documents without the filtered key are excluded from retrieval entirely.
Schema design tips
Decide your schema before ingesting
You can't add metadata to documents after ingest without re-ingesting them. Plan your filter dimensions upfront.
Use consistent key names
Inconsistent casing or spelling breaks filtering. "Department" and "department" are different keys.
Add a document_type key to everything
This is the most useful filter in practice. Values like "policy", "contract", "handbook", "runbook" let you scope queries precisely.
For multi-tenant applications
Add a "tenant_id" or "client_id" key. This lets you scope all queries to one customer's documents without needing separate jack organisations.