A n8n community node for using Hologres as a vector database with HGraph vector index support.
- Vector Storage: Store documents and embedding vectors in Hologres
- HGraph Index Support: Leverage Hologres' HGraph vector index for high-performance similarity search
- Multiple Operation Modes:
- Get Many: Retrieve top-ranked documents for a given query
- Insert Documents: Insert documents into the vector store
- Update Documents: Update existing documents by ID
- Retrieve Documents: Retrieve documents for use with other AI nodes
- Retrieve Documents (As Tool): Use as a retrieval tool for AI Agents
- Flexible Configuration: Customize table names, column names, distance methods, and more
- Metadata Filtering: Filter documents based on metadata
- n8n >= 1.0.0
- Hologres instance (version supporting HGraph vector index)
- Node.js >= 18
- In n8n, go to Settings > Community Nodes
- Click Install
- Enter the package name
n8n-nodes-hologres-vectorstore - Agree to the security prompt and wait for installation to complete
npm install n8n-nodes-hologres-vectorstoreConfigure Hologres connection information in n8n:
| Parameter | Description | Default |
|---|---|---|
| Host | Hologres instance address | localhost |
| Port | Port number | 80 |
| Database | Database name | postgres |
| User | Username | - |
| Password | Password | - |
| Maximum Number of Connections | Maximum number of connections | 100 |
| SSL | SSL connection options | disable |
| Allow Unauthorized Certificates | Allow unauthorized certificates | false |
| Parameter | Description | Default |
|---|---|---|
| Table Name | Table name for storing vectors | n8n_hologres_vectors |
| Dimensions | Vector dimensions (must match your embedding model output) | 1536 |
| Distance Method | Distance calculation method | Cosine |
| Embedding Batch Size | Number of documents to embed in a single batch | 10 |
- Cosine: Cosine similarity (recommended for semantic search)
- Inner Product: Inner product
- Euclidean: Euclidean distance
| Parameter | Description | Default |
|---|---|---|
| ID Column Name | ID column name | id |
| Vector Column Name | Vector column name | embedding |
| Content Column Name | Content column name | text |
| Metadata Column Name | Metadata column name | metadata |
| Parameter | Description | Default |
|---|---|---|
| Base Quantization Type | Base quantization type | rabitq |
| Use Reorder | Whether to use reordering | true |
| Precise Quantization Type | High-precision quantization type | fp32 |
| Precise IO Type | High-precision index storage medium | block_memory_io |
| Max Degree | Maximum connections per vertex | 64 |
| EF Construction | Search depth during index construction | 400 |
- Select Insert Documents mode
- Connect an Embedding node (e.g., OpenAI Embeddings)
- Connect a Document node (providing documents to store)
- Configure table name and vector dimensions
- Optional: Adjust Embedding Batch Size if your embedding model has batch size limits
- Run the workflow
Note: Documents are processed in batches according to the Embedding Batch Size setting. This helps prevent timeout issues with large document sets or embedding models with strict batch limits.
- Select Update Documents mode
- Connect an Embedding node (for re-embedding the updated content)
- Connect a Document node (providing the updated document)
- Enter the ID of the document to update
- Configure table name and column names (if different from defaults)
- Run the workflow
Note: The update operation will re-embed the document content and update both the vector and metadata in the database.
- Select Get Many or Retrieve Documents mode
- Connect an Embedding node
- Enter a search prompt
- Set the number of results to return (Limit)
- Optional: Configure metadata filters
- Select Retrieve Documents (As Tool) mode
- Configure the tool name and description
- Connect to an AI Agent node
When used in execute mode (with a Main input connection), the node expects the input item to contain either:
chatInputfield - The query stringqueryfield - Alternative query field
This allows direct querying of the vector store without an AI Agent.
# Install dependencies
npm install
# Development mode (hot reload)
npm run dev
# Code formatting
npm run format
# Linting
npm run lint
# Build
npm run build# Update version (automatically runs lint + build twice)
# For patch releases (bug fixes)
npm version patch
# For minor releases (new features, backward compatible)
npm version minor
# For major releases (breaking changes)
npm version major
# Login
npm login
# Publish
npm publish --dry-run # Test publish first
npm publish
# Push tags
git push origin --tagsNote:
npm versionwill automatically runnpm run lint && npm run buildbefore updating the version, then runnpm run buildagain after to ensure the build artifacts contain the new version number.
This project includes both unit tests and integration tests.
Unit tests use mocked database connections and can run without a real Hologres instance.
# Run unit tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage report
npm run test:coverageIntegration tests require a real Hologres database connection to test actual database operations.
-
Copy the example environment file:
cp .env.test.example .env.test
-
Edit
.env.testwith your Hologres connection details:HOLOGRES_HOST=your-instance.hologres.aliyuncs.com HOLOGRES_PORT=80 HOLOGRES_DATABASE=your_database HOLOGRES_USER=your_user HOLOGRES_PASSWORD=your_password
# Run integration tests only
npm run test:integration
# Run all tests (unit + integration)
npm run test:allNote: Integration tests will be automatically skipped if the database connection is not configured. This allows CI/CD pipelines to run unit tests without requiring a database.
__tests__/
├── setup.ts # Global mock setup for unit tests
├── mocks/
│ ├── pg.mock.ts # PostgreSQL client mocks
│ ├── embeddings.mock.ts # Fake embeddings for testing
│ ├── hologres-store.mock.ts # HologresVectorStore mocks
│ └── n8n-context.mock.ts # n8n execution context mocks
├── unit/
│ ├── HologresVectorStore.test.ts # Core vector store tests
│ └── helpers.test.ts # Helper function tests
└── integration/
├── setup.ts # Integration test configuration
├── HologresVectorStore.integration.test.ts # Core DB operations
├── VectorStoreHologres.node.integration.test.ts # Node tests
├── configurations.integration.test.ts # Configuration tests
├── edge-cases.integration.test.ts # Edge case handling
├── error-handling.integration.test.ts # Error handling tests
├── node-parameters.integration.test.ts # Node parameter tests
└── performance.integration.test.ts # Performance tests
Current test coverage:
| Metric | Coverage |
|---|---|
| Statements | 100% |
| Branches | 96% |
| Functions | 100% |
| Lines | 100% |
- n8n-workflow - n8n workflow SDK
- @langchain/core - LangChain core library
- pg - PostgreSQL client
Apache-2.0