Zilliz RAG Knowledge Base icon

Zilliz RAG Knowledge Base

Build and manage RAG knowledge base with Zilliz vector database

Semantic Search

AI-generated

Overview

This node integrates with the Zilliz vector database to perform semantic search operations on a knowledge base. Specifically, the Semantic Search operation allows users to query a collection of documents using natural language or pre-computed query vectors, retrieving the most relevant documents based on vector similarity.

Common scenarios include:

  • Searching large document collections for relevant information using natural language queries.
  • Enhancing AI assistants by retrieving contextually relevant documents from a knowledge base.
  • Implementing semantic search features in applications where keyword matching is insufficient.

For example, a user can input a question in natural language, and the node will return the top matching documents from a specified Zilliz collection, including their metadata if desired.

Properties

Name Meaning
Database Name Name of the Zilliz database to use (default: "default").
Collection Name Name of the Zilliz collection to search within. Must start with a letter and contain only letters, numbers, and underscores.
Query Text Natural language query string for semantic search.
Query Vector Pre-computed embedding vector representing the query (JSON array).
Search Options Collection of options controlling the search behavior:
- Max Results Maximum number of relevant documents to return (1-100).
- Similarity Threshold Minimum similarity score (0-1) to filter results.
- Filter Expression Additional filter conditions to apply during search (string expression).
- Include Metadata Boolean flag indicating whether to include full document metadata in the results.

Output

The output JSON contains the following fields:

  • query: The original query text or indication that a vector query was used.
  • total_results: Number of documents returned after applying similarity threshold.
  • search_results: An array of matched documents, each containing:
    • rank: Position in the result list (1-based).
    • similarity_score: Similarity score between query and document vector.
    • document_id: Unique identifier of the matched document.
    • title: Document title.
    • text_chunk: The text content of the matched chunk.
    • chunk_index: Index of the chunk within the document.
    • metadata (optional): Full metadata of the document if included.
  • context_text: Concatenated text chunks from all matched documents, separated by two newlines.
  • collection: The name of the collection searched.
  • database: The database name used.

No binary data output is produced by this operation.

Dependencies

  • Requires an active connection to a Zilliz vector database cluster.
  • Needs an API key credential and cluster endpoint configured in n8n credentials.
  • The node depends on the external ZillizClient library to interact with the Zilliz service.

Troubleshooting

  • Error: "Invalid JSON in Query Vector parameter"
    Occurs if the provided query vector string is not valid JSON. Ensure the vector is a properly formatted JSON array.

  • Error: "Query vector required. Please compute embeddings for the query text using an embedding node."
    Happens when neither a query vector nor a query text is provided. To fix, either supply a natural language query (which must be embedded beforehand) or provide a pre-computed query vector.

  • Error: "Either Query Text or Query Vector must be provided"
    Indicates missing input for the search. Provide at least one of these inputs.

  • Empty or no results returned
    Could be due to overly restrictive similarity threshold or filters. Try lowering the threshold or removing filters.

  • Collection or database not found
    Verify that the specified database and collection names exist and are correctly spelled.

Links and References

Discussion