Knowledge Base Query
Knowledge Base Query embeds a question and returns the most similar documents from a knowledge base, each with an honest score. It is the search read path of the RAG pipeline; Read Knowledge Base is the other, and choosing between them matters more than any tuning field on this page. You find it on the node picker’s AI shelf.
Ingest: Read a File as Text → Split Text → Contextualize Chunks (optional) → Embed → Knowledge Base InsertRead back: Knowledge Base Query (search) or Read Knowledge Base (read whole)The node has one input handle and one output handle. The query embedding is a paid API call; leave Embedding credential empty to use the knowledge base’s own embedding secret, or pick a secret or connection. Reranking takes a separate one, Reranking credential, since it is usually a different vendor.
What the knobs do
Section titled “What the knobs do”The form shows Knowledge base, Search for and Number of results first. Every setting below sits under More settings.
- Lowest similarity to keep (
minSimilarity) is the difference between a search and a guess. Without it the node always returnstopKrows, even for a question the knowledge base cannot answer, and an agent handed five irrelevant chunks answers from them. With it, an empty result is the correct answer to “we do not know”. Calibrate against real questions:text-embedding-3-*scores sit well below the older rules of thumb, and a copied threshold silently returns nothing. Left empty, the cutoff calibrated on the knowledge base applies. - Also match keywords (
hybrid) adds a keyword leg and merges the two rankings. It helps most with product names, error codes, and jargon, the terms a purely semantic search paraphrases away. A keyword hit is exempt fromminSimilarity, since every query term being present is independent evidence of relevance. - Rerank the matches (
rerank) re-scores the fetched candidates with a reranking model after the cutoff and before thetopKtruncation. If the rerank provider is down the node does not fail; it returns unreranked results withrerank.applied: false. - Chunks either side of a match (
expandNeighbors) returns each match with the chunks either side of it, joined; Return whole documents (wholeDocument) returns the whole document each match came from, deduplicated per source. Both run as the last stage, so neither can resurrect a filtered-out match, and both can return fewer thantopKresults. Setting both fails the node.
Embedding provider and Embedding model default to what the knowledge base was embedded with, which is almost always right; an override that disagrees with the knowledge base fails the node rather than returning confident nonsense.
Configuration
Section titled “Configuration”

| Field | Type | Default | Description |
|---|---|---|---|
Knowledge base (collectionId) | string ✦ (required) | — | The knowledge base to search for the nearest matching documents. |
Search for (query) | string ✦ (required) | — | The text to embed and search for; the most similar documents in the knowledge base are returned. |
Number of results (topK) | integer ✦ (optional) | 5 |
How many of the nearest matching documents to return. |
Embedding provider (embeddingProvider) | one of openai, anthropic, gemini, ollama, mistral, groq, xai, voyageai, openrouter, typesafe, eleven, openai-compatible, soniox ✦ (optional) |
— | The AI provider used to embed the query. Leave empty to use the one the knowledge base was embedded with. |
Embedding model (embeddingModel) | string ✦ (optional) | — | The embedding model used to embed the query, e.g. text-embedding-3-small. Leave empty to use the one the knowledge base was embedded with. |
Chunks either side of a match (expandNeighbors) | integer ✦ (optional) | — | Also return this many chunks either side of each match, joined together. Use it when a match is a fragment and the answer needs its surroundings — 1 or 2 is usually enough. Leave empty or 0 for the matching chunk alone. |
Return whole documents (wholeDocument) | boolean ✦ (optional) | — | Return the WHOLE document each match came from, instead of the matching chunk. Use it when your sources are short, self-contained articles and an answer needs the whole thing — the model gets one coherent document per result rather than a paragraph torn out of the middle. Leave empty for the matching chunks alone. |
Lowest similarity to keep (minSimilarity) | number ✦ (optional) | — | Drop any match less similar than this, from 0 (unrelated) to 1 (identical). Leave empty to use the cutoff calibrated on the knowledge base itself, if it has one. |
Embedding credential (credential) | string ✦ (optional) | — | The API key for the embedding provider, picked from your secrets. Leave empty to use the knowledge base’s own embedding secret, or if this provider’s key is already configured on the server. |
Also match keywords (hybrid) | boolean ✦ (optional) | — | Also match on keywords, not just meaning, and merge the two rankings. Leave empty to follow the knowledge base’s setting. Helps most with product names, error codes, article numbers and jargon — the terms a purely semantic search paraphrases away. |
Rerank the matches (rerank) | boolean ✦ (optional) | — | Re-score the matches with a reranking model before returning them, so the best few end up at the top. Leave empty to follow the knowledge base’s setting. Adds roughly half a second and a per-search fee (about $1–2.50 per 1,000 searches), and usually improves which results land in the top few. |
Matches to rerank (rerankCandidates) | integer ✦ (optional) | — | How many matches to fetch and re-score before keeping the top K (default 50). More candidates means better results and a slower, dearer search. |
Reranking provider (rerankProvider) | one of cohere.com, voyageai.com ✦ (optional) |
— | The reranking provider. Leave empty to use the knowledge base’s. |
Reranking model (rerankModel) | string ✦ (optional) | — | The reranking model, e.g. rerank-2.5. Leave empty to use the knowledge base’s. |
Reranking credential (rerankCredential) | string ✦ (optional) | — | The credential for the reranking provider — a Secret or a saved Connection. Leave empty to use the knowledge base’s own, or the key configured on the server. |
Fields marked ✦ accept expressions.
Try this node — run it once against your own workspace, with your credentials, without building a flow first.
Output
Section titled “Output”{ "results": [ { "text": "Matching chunk...", "metadata": { "title": "Employee handbook" }, "distance": 0.23, "similarity": 0.77 } ], "collection_id": "01kta3s3r8292bh37btk6m947y"}Hybrid search adds legs and fusion_score per hit, reranking adds rerank_score per hit and a rerank envelope, and whole-document expansion adds chunks_matched per result.
As an agent tool
Section titled “As an agent tool”Wire the node’s output to an Agent’s Tools handle to expose it as search_knowledge_base. In the featured LLM / Agent — RAG Q&A template, the query field holds a tool parameter the agent fills per call:
{$fromAI:question:Free-text question to look up in the docs:string}The tool only reads, so it stays available in every approval mode, including read-only.
Example
Section titled “Example”The template Rag / VectorStore / Query under Automation → Templates searches a demo knowledge base with topK 3, taking the question from the previous node:
{!! $prev->q !!}The raw tags {!! !!} pass the question on as it was written. {{ }} would HTML-escape it, so a question with an apostrophe or an ampersand would be embedded, and searched for, with ' or & in it.
Limitations
Section titled “Limitations”- Setting both
expandNeighborsandwholeDocumentfails the node: a document boundary is not a radius, so pick one. - The neighbour radius has a platform maximum (10 by default). A larger radius fails rather than being quietly reduced.
- Neighbours are found by source key and chunk position, so a document stored without a source key, or before chunk ordering existed, comes back unexpanded.
- A rerank candidate pool larger than the chosen model accepts per call fails the node, rather than reranking a prefix and returning a worse list that looks identical to a good one.
- A rerank provider and model the platform does not know turns reranking off silently. Prefer setting both on the knowledge base and leaving them empty here.
Related
Section titled “Related”- Read Knowledge Base hands over a small knowledge base whole instead of searching it.
- Knowledge Base Insert is what fills the knowledge base.
- Agent uses this node as its knowledge-base search tool.
- Knowledge bases covers creating and inspecting knowledge bases; a knowledge base’s own settings are what every field left empty here falls back to.
- How to choose between searching and reading covers when a search is the wrong shape for the question.