Skip to main content

Vector Search Database

Controlled node

Overview

The Vector Search Database node performs semantic similarity searches on vector embeddings stored in a project database. It compares an input query vector against vectors stored in a specified column using various distance metrics (cosine similarity, inner product, L2 distance, or L1 distance) and returns the most similar rows.

This node is essential for implementing semantic search, recommendation systems, or any workflow requiring similarity matching on high-dimensional vector data (such as text embeddings or image embeddings).

Distance Metrics

The node supports multiple distance metrics for calculating similarity:

MetricDescriptionBest For
Cosine SimilarityMeasures the cosine of the angle between two vectorsText embeddings, semantic similarity where magnitude doesn't matter
Inner ProductStandard dot product of vectorsWhen vectors are normalized or for specific ML models
L2 DistanceEuclidean distance between vectorsPhysical distance measurements, image embeddings
L1 DistanceManhattan distance between vectorsRobust to outliers, sparse vectors
Vector Column Setup

Ensure your database table has a column containing vector data (typically generated using the Get Embeddings node or similar). The default column name is embedding, but this can be configured.

Inputs

InputTypeDescriptionDefault
RunEventTriggers the vector search operation-
Database IDTextThe ID of the project database to search-
Table IDTextThe ID of the table within the database-
Column IDTextThe name of the column containing vector embeddingsembedding
VectorDataThe query vector (array of numbers) to search for-
LimitNumberMaximum number of similar results to return10
Distance MetricEnumThe similarity metric to use: cosine, innerProduct, l2, or l1cosine

Outputs

OutputTypeDescription
DoneEventFires when the search operation completes successfully
ResultDataArray of matching rows, typically including the row data and similarity scores

Runtime Behavior

When triggered by the Run event, the node executes a vector similarity search against the specified database table. It validates that:

  • The database and table exist and are accessible
  • The vector column exists in the table
  • The input vector is a valid non-empty array of numbers
  • The limit is a positive number

The node returns an array of rows sorted by similarity (closest matches first). Each result typically includes the original row data plus a score indicating the distance/similarity to the query vector.

If the input vector is invalid, empty, or the specified column doesn't exist, the node returns an error object in the Result output.

Example Usage

Scenario: Finding similar documents based on a text query

  1. Use AI Write or Get Embeddings to generate an embedding vector for your search query
  2. Connect the vector output to the Vector input of Vector Search Database
  3. Configure the node with your database ID, table ID, and the column name where document embeddings are stored (e.g., embedding)
  4. Set the Limit to control how many similar documents to retrieve (e.g., 5)
  5. Choose Cosine Similarity for text embeddings
  6. When triggered, the node returns the most semantically similar documents from your database

Typical Workflow:

[Get Embeddings] → [Vector Search Database] → [For Each]
↑ ↓ ↓
Query Text Similar Documents Process Results
Performance Considerations

Vector searches on large datasets may take time depending on the database size and whether vector indexes are configured. For production use with large tables, ensure your database has appropriate vector indexing enabled.