AI Knowledge
AI Knowledge is the platform’s search service. It runs as know.svc, and its service
name is search: that is the name its configuration, its logs and its error messages use.
A product declares the documents it searches and the backends that hold them in its search/
folder; callers index documents and search them per tenant, and every operation is checked
against the document’s own access rules.
Two kinds of search
Section titled “Two kinds of search”| Backend type | Engine | A search sends | Matches on |
|---|---|---|---|
lexical | Meilisearch | query, a text string | Terms in the fields declared index: true, or in every field when none is |
semantic | pgvector or Milvus | vector, the query embedding | Nearest neighbours of a floatvector field |
A backend is one or the other, and each search goes to one backend. Both kinds take the same
filter grammar, and both return results with a score where higher is better.
Vectors are computed by the caller. Index a document with its embedding already in the vector
field, and search with the query’s embedding. The AI Gateway computes
embeddings (POST /v1/embeddings), and so does AI Flow’s embed task, so a
flow can embed and index in one pipeline.
Backends
Section titled “Backends”| Engine | Use it for | Stores |
|---|---|---|
| Meilisearch | Text search with typo tolerance and filters | One index per tenant and document |
| pgvector | Vector search beside your relational data | Tables in the tenant’s search datastore, through the platform’s data engine |
| Milvus | Vector search over large collections | One collection per tenant and document |
Which backend holds a document is declared in the product, so a document with one vector field can move from pgvector to Milvus with the callers’ requests changing only in the backend name.
Access
Section titled “Access”Each document carries an access: block in the same grammar as a Data
entity: actions says who may search, index and delete it, and rls says which documents
each caller sees or may change. The rules are enforced on every backend, inside the search
itself, so a limit: 10 returns ten documents the caller may read.
Indexing and searching
Section titled “Indexing and searching”POST /index/siteAuthorization: Bearer <token>X-Customer: acmeX-Product: crmX-Env: prodX-Tenant: t1
{ "doctype": "pages", "docid": "intro", "document": { "title": "Getting started", "team": "docs" } }PATCH /index/site/pages
{ "query": "getting started", "filter": { "team": "docs" }, "limit": 5 }{ "results": [ { "docid": "intro", "score": 0.98, "data": { "id": "intro", "title": "Getting started", "team": "docs", "slug": "getting-started" } } ]}Keeping documents in step with Data
Section titled “Keeping documents in step with Data”A document can follow a Data entity: Data’s event outbox posts every committed change of the entity to the search service, which indexes or deletes the matching document. See Configuration.
Where it fits
Section titled “Where it fits”AI Knowledge holds your corpus and answers searches over it. Conversation history and long-term recall are AI Memory.
- Core Concepts: documents, fields, backends, scores and access
- Configuration: the
search/folder, backend connections and sync - API: every route, request and error
- Operations: reloads, storage names and what to watch