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:
| Metric | Description | Best For |
|---|---|---|
| Cosine Similarity | Measures the cosine of the angle between two vectors | Text embeddings, semantic similarity where magnitude doesn't matter |
| Inner Product | Standard dot product of vectors | When vectors are normalized or for specific ML models |
| L2 Distance | Euclidean distance between vectors | Physical distance measurements, image embeddings |
| L1 Distance | Manhattan distance between vectors | Robust to outliers, sparse vectors |
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
| Input | Type | Description | Default |
|---|---|---|---|
| Run | Event | Triggers the vector search operation | - |
| Database ID | Text | The ID of the project database to search | - |
| Table ID | Text | The ID of the table within the database | - |
| Column ID | Text | The name of the column containing vector embeddings | embedding |
| Vector | Data | The query vector (array of numbers) to search for | - |
| Limit | Number | Maximum number of similar results to return | 10 |
| Distance Metric | Enum | The similarity metric to use: cosine, innerProduct, l2, or l1 | cosine |
Outputs
| Output | Type | Description |
|---|---|---|
| Done | Event | Fires when the search operation completes successfully |
| Result | Data | Array 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
- Use AI Write or Get Embeddings to generate an embedding vector for your search query
- Connect the vector output to the Vector input of Vector Search Database
- Configure the node with your database ID, table ID, and the column name where document embeddings are stored (e.g.,
embedding) - Set the Limit to control how many similar documents to retrieve (e.g., 5)
- Choose Cosine Similarity for text embeddings
- 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
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.