Query
Unified retrieval over knowledge, memories, or both.
typepicks what to query:"knowledge","memory", or"all"(both, merged and re-ranked together).query_bypicks how to match:"hybrid"(semantic + BM25, the default) or"text"(BM25 only - pair withoperator).modepicks how to rank results:"fast"(single-pass, low-latency),"thinking"(expands query, reranks, and can include forceful-relation context), or"auto"(scores the query and routes to"fast"or"thinking"automatically, defaulting to"thinking"when the signal is inconclusive - the default ifmodeis omitted).
database and collection are the current field names (formerly tenant_id and sub_tenant_id). The old names remain accepted as deprecated aliases for full backward compatibility.Querying multiple collections
Usecollections when one query should fan out across multiple user, workspace, or team scopes. The field accepts either a list or a weighted object:
max_results is omitted, HydraDB uses up to 10 results per collection, capped at 1000 fanout candidates before the final ranked response is shaped. When max_results is set, it is the final global response cap across the merged fanout result set.
Caching tip: collections list order is not semantically significant for fanout selection. Sort list values before constructing cache keys; for weighted objects, sort keys and keep weights at the documented one-decimal precision so equivalent calls share the same cache entry.
Transforming the response into LLM context
Usebuild_string / buildString from the SDK. It takes any POST /query result and returns a formatted plain string.
Common use-cases and their configurations
2. Personalized answer - combine knowledge with user memories
2. Personalized answer - combine knowledge with user memories
3. Retrieve user preferences - query only user memories
3. Retrieve user preferences - query only user memories
4. Exact phrase lookup - BM25 for legal terms, SKUs, or IDs
4. Exact phrase lookup - BM25 for legal terms, SKUs, or IDs
5. Let HydraDB decide - auto-route between fast and thinking
5. Let HydraDB decide - auto-route between fast and thinking
"fast" or "thinking" - a query naming several distinct entities like this one is likely to route to "thinking". Use "auto" for traffic where query complexity varies call-to-call and you don’t want to hand-pick per request. This is also the default: an omitted mode field behaves exactly like mode: "auto". Set mode to "fast" or "thinking" explicitly if you want a deterministic pipeline instead.Request body
Decision matrix
Type selection
Type selection
Query methods
Query methods
Modes
Modes
query_by: "hybrid":"auto"’s resolved pipeline isn’t reported back in the response, so budget latency as thinking-level in the worst case. Omitting mode behaves exactly like mode: "auto" - set it explicitly to "fast" or "thinking" if you want a deterministic pipeline instead.Filters
Filters
metadata_filters are hard exact-match constraints applied before ranking and re-checked after hydration. The shape combines two filter scopes:metadata_filters; run multiple queries or post-process client-side for those cases.Behavior notes
modedefaults to"auto". Omittingmodeentirely behaves exactly likemode: "auto"- set it explicitly to"fast"or"thinking"if you want a deterministic pipeline.graph_contextis on by default. Set it tofalseif you only need ranked chunks and want to drop the graph slice from the response.recency_biasis off by default. Defaults to0.0- no recency boost is applied unless you set it.
Errors
Common codes:400 INVALID_PARAMETERS (empty query), 404 DATABASE_NOT_FOUND, 422 VALIDATION_ERROR, 500 INTERNAL_ERROR. See Error Responses for the full list.
Authorizations
API key sent as a Bearer token: "Bearer prefix.secret"
Body
Unified query request
Optional context string prepended to the query to improve retrieval relevance.
"The user is a senior engineer onboarding to the platform."
Weighting balance between dense and sparse retrieval in hybrid mode. "auto" lets HydraDB choose; a number from 0 (full BM25) to 1 (full dense) sets it explicitly.
Collection scope. Defaults to the default collection when omitted. Formerly sub_tenant_id; the sub_tenant_id alias is still accepted (deprecated).
"team_docs"
Preferred /query scope selector. Send either a list of collection IDs for equal normalized weighting, or an object mapping collection ID to a positive relative ranking weight with at most one decimal place. Do not send together with the deprecated sub_tenant_ids or sub_tenant_id.
1 - 100 elementsDatabase is the canonical v2 name for the tenant scope. TenantID is its deprecated alias and remains fully accepted. The TenantAliases middleware reconciles the two before binding, so TenantID is always populated and the handler reads it; Database/Collection are carried only for docs/OpenAPI.
"acme_corp"
Whether to include graph context in the response. Defaults to true for /query when omitted.
true
GraphVectorPrune switches the graph-connected-chunks lane from "fetch graph-selected chunks and let the fusion reranker sort them out" to "fetch a wider graph-selected candidate pool, then rank that pool by Milvus vector similarity, fully replacing the final chunk list." Works in either fast or thinking mode. Default false preserves existing behavior. Also gated server-side by a repo-level config flag (SearchService's graphVectorPruneEnabled) — if that flag is off, this is forced to false regardless of what the request sets, so a deployment can disable the mechanism without any client-side change.
true
GraphVectorPruneSpacyEntities: when GraphVectorPrune is also set, swaps the graph lane's entity-extraction source from the default LLM-based extractor to a local spaCy subprocess (faster, no network round trip, but a narrower/mismatched entity vocabulary versus the graph's own LLM-extracted node names). No-op if GraphVectorPrune is false (including when forced false by the server-level flag) or no spaCy extractor was configured at startup.
true
IDs optionally scopes retrieval to specific source ids. The v2 wire field is
ids (matching /context/list); empty means search the whole corpus. Applied
as a Milvus source_id in [...] pre-filter that is preserved across the
metadata zero-result retry, so a source-scoped search that matches nothing
returns nothing rather than silently widening to the whole corpus.
Maximum number of chunks to return.
10
Filters results by source metadata. Top-level keys target tenant metadata (for example department, priority, active, or tags). Nested additional_metadata keys target document metadata. Values are exact-match scalars or arrays for set-equality/list-style filters.
fast, thinking, auto "thinking"
Number of adjacent chunks to pull alongside each matched chunk for additional context.
3
or, and, phrase "and"
Natural-language search query.
"Which mode does the user prefer?"
Whether to include app-aware knowledge retrieval. Applies to knowledge hybrid queries.
true
Retrieval method to use for the query.
hybrid, text "hybrid"
Whether to force relation expansion for graph-aware query retrieval. Defaults to true when omitted.
true
Recency boost applied to ranking. 0 disables it; higher values favour more recent sources.
0.2
Deprecated for /query (since 2.0.1). Use collection for a single scope or collections for multiple. Backwards-compatible and will be removed in a future version. Do not send together with a multi-scope selector.
"sub_tenant_4567"
Deprecated for /query (since 2.0.1). Use collections instead; it accepts the same list or weighted-object shape. Backwards-compatible and will be removed in a future version. Do not send together with collections.
1 - 100 elementsdeprecated: use database
"tenant_1234"
Corpus to query: knowledge, memory, or all.
knowledge, memory, all