Summary
Add support for querying across multiple namespaces in a single request, with results merged and ranked before returning.
Motivation
Firn's multi-tenant model maps each tenant to an isolated object-storage prefix, which is the right isolation boundary. But in practice, callers often need to search across multiple namespaces — for example, a tenant that organises data into per-collection namespaces, or a user with access to several independent datasets.
Today this requires N sequential or parallel client-side requests followed by client-side merge and re-ranking. That's expensive, error-prone, and bypasses any server-side caching benefits.
Proposed API shape
A new /query-multi endpoint (or a namespaces: [...] field on the existing /ns/{ns}/query):
{
"namespaces": ["ns-a", "ns-b", "ns-c"],
"query_vector": [...],
"top_k": 20
}
The server fans out to each namespace in parallel, merges results using the same scoring, and returns a unified ranked list with a namespace field on each result.
Access control
Each namespace in the list should be checked independently against the caller's credentials. Namespaces the caller doesn't have access to are silently skipped (or optionally returned as an error entry in a partial_failures field).
Notes
- The tiered cache means namespace-local L1/L2 hits can be served without touching S3 at all, so the scatter step is often much cheaper than N independent HTTP calls.
- Start with a cap on the number of namespaces per request (e.g. 16) to bound fan-out.
- Long-term, this is also the natural foundation for cross-tenant analytics and aggregation features.
Summary
Add support for querying across multiple namespaces in a single request, with results merged and ranked before returning.
Motivation
Firn's multi-tenant model maps each tenant to an isolated object-storage prefix, which is the right isolation boundary. But in practice, callers often need to search across multiple namespaces — for example, a tenant that organises data into per-collection namespaces, or a user with access to several independent datasets.
Today this requires N sequential or parallel client-side requests followed by client-side merge and re-ranking. That's expensive, error-prone, and bypasses any server-side caching benefits.
Proposed API shape
A new
/query-multiendpoint (or anamespaces: [...]field on the existing/ns/{ns}/query):{ "namespaces": ["ns-a", "ns-b", "ns-c"], "query_vector": [...], "top_k": 20 }The server fans out to each namespace in parallel, merges results using the same scoring, and returns a unified ranked list with a
namespacefield on each result.Access control
Each namespace in the list should be checked independently against the caller's credentials. Namespaces the caller doesn't have access to are silently skipped (or optionally returned as an error entry in a
partial_failuresfield).Notes