Querying Your Knowledge Base

Search your knowledge base from workflows using natural language.

Overview

A query takes a natural language question, compares it against the embeddings of every document in a collection, and returns the most relevant passages. There is no keyword index and no query language to learn; the relevance ranking is semantic, so phrasing your question the way a person would ask it usually works best.

Queries run from inside a workflow using a Knowledge node. The node takes a collection and a query string, then exposes the returned passages as a variable that downstream steps (a Transform, a Connector, a Send Email) can reference.

Before You Start

  • You need a collection that already contains processed documents. New uploads must finish embedding before they appear in results.
  • You need a workflow open in the designer where you can add the Knowledge node.

Steps

  1. In the workflow designer, drag a Knowledge node onto the canvas and connect it after the step that produces your query input.
  2. Open the node properties panel and set Mode to Query.
  3. Pick the target collection from the Collection dropdown.
  4. Enter the Query. You can hardcode a string, or insert a variable like {{ trigger.question }} for a dynamic input.
  5. Set Top K to the number of passages you want back. Three to five is a sensible starting point for most use cases.
  6. Reference the node's output in later steps using its result variable, for example {{ knowledge.results }}.

Settings

  • Collection - The collection to search. A node queries one collection at a time.
  • Query - The natural language question. Accepts handlebars variables.
  • Top K - How many passages to return, ordered by relevance.

Writing Good Queries

  • Ask a specific question. What is the warranty period for Model X? beats warranty info.
  • Include the proper nouns that appear in the source documents (product names, policy IDs, customer types). They anchor the semantic match.
  • If a query consistently misses, check the underlying document. The phrasing in the source affects what the embedding represents.

Tips

  • Iterate on the query in the designer using the run/test panel before committing to it in production.
  • For long passages, follow the Knowledge node with a Transform node to summarise or extract the field you actually need.
  • If different parts of the workflow need different facts, run two Knowledge nodes against the same collection with different queries rather than one giant query.

Common Pitfalls

  • Querying a collection that mixes unrelated topics. Relevance drops sharply when the collection is unfocused.
  • Treating the result as a single answer. The node returns ranked passages, not a definitive answer; combine it with a Transform when you need a clean string.
  • Using stale documents. If the source has changed, re-upload before relying on the query.
  • Setting Top K too high and feeding huge result sets into a downstream LLM step, which wastes tokens.

Related Articles

Learn More

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.