milvus-enhanced

n8n community node for Milvus vector database with enhanced metric type switching

Package Information

Released: 13 mo ago
Downloads: 29 weekly / 66 monthly
Latest Version: 1.1.12
Author: Your Name

Documentation

n8n-nodes-milvus-enhanced

An n8n community node for Milvus vector database with enhanced metric type switching capabilities.

n8n.io - Workflow Automation

Features

  • New Credential: Uses a new milvusNew credential separate from built-in n8n Milvus nodes
  • AI Tool Integration: Use as an AI tool for document retrieval in LangChain workflows
  • Enhanced Metric Type Support: Switch between different similarity metrics (L2, IP, Cosine, Hamming, Jaccard)
  • Complete CRUD Operations: Insert, search, query, and delete operations
  • Collection Management: Create collections with configurable metric types
  • Advanced Search: Support for vector similarity search with customizable parameters
  • Filtering: Boolean expression filtering for precise results
  • Flexible Configuration: Configurable vector dimensions and search parameters
  • Resource Locator: Easy collection selection with dropdown list

Installation

To install this community node in your n8n instance:

Manual Installation

  1. Navigate to your n8n installation directory
  2. Install the package:
    npm install n8n-nodes-milvus-enhanced
    
  3. Restart n8n

Using n8n Editor UI

  1. Go to Settings → Community Nodes
  2. Click Install a community node
  3. Enter: n8n-nodes-milvus-enhanced
  4. Click Install

Troubleshooting Installation

If you encounter the error "The specified package could not be loaded":

  1. Check Package Structure: Ensure the package includes all required files:

    npm run build
    npm run lint
    
  2. Verify n8n Version: Ensure you're running n8n version 1.0.0 or higher

  3. Manual Installation: If UI installation fails, try manual installation:

    npm install n8n-nodes-milvus-enhanced
    # Restart n8n
    
  4. Clear Cache: Clear n8n's cache and restart:

    # Stop n8n, then:
    rm -rf ~/.n8n/cache
    # Start n8n again
    

Configuration

Credentials Setup

  1. Create a new "Milvus New API" credential in n8n
  2. Configure the following:
    • Base URL: Full Milvus server URL (e.g., http://10.42.0.230:19530)
    • Username: Authentication username
    • Password: Authentication password

Operations

Retrieve as Tool (AI Integration)

Use the node as an AI tool for document retrieval with embedding support:

  • Tool Description: Custom description for the AI agent
  • Collection: Select from existing collections using resource locator
  • Top K: Number of documents to retrieve
  • Search Metric Type: Override metric type for search operations (L2, IP, Cosine, Hamming, Jaccard)
  • Takes ai_embedding input from embedding models
  • Provides ai_tool output to AI agents

Insert Documents

Insert documents and vectors into a collection:

  • Collection: Target collection (resource locator)
  • Data: JSON array of documents to insert

Get Many

Retrieve documents from a collection:

  • Collection: Source collection (resource locator)
  • Top K: Number of documents to return
  • Search Parameters: Advanced retrieval options

Create Collection

Create a new collection with a specified metric type:

  • Collection Name: Name of the collection to create
  • Metric Type: Choose from L2, IP, Cosine, Hamming, or Jaccard
  • Vector Dimension: Dimension of vector fields
  • Description: Optional collection description

Insert Vectors

Insert vectors into a collection:

  • Collection Name: Target collection
  • Data: JSON array of data objects to insert

Search Vectors

Search for similar vectors with configurable metric types:

  • Collection Name: Collection to search in
  • Metric Type: Similarity metric (L2, IP, Cosine, Hamming, Jaccard)
  • Vectors: Query vectors as JSON array
  • Top K: Number of results to return
  • Search Parameters: Advanced search parameters
  • Output Fields: Fields to include in results
  • Filter Expression: Boolean filter expression

Query Vectors

Query vectors by filter expressions:

  • Collection Name: Target collection
  • Filter Expression: Boolean expression for filtering
  • Output Fields: Fields to include in results

Delete Vectors

Delete vectors based on filter expressions:

  • Collection Name: Target collection
  • Filter Expression: Boolean expression for deletion criteria

List Collections

List all available collections in the database.

Supported Metric Types

Metric Type Description Use Case
L2 Euclidean distance General purpose, normalized vectors
IP Inner Product Cosine similarity for normalized vectors
Cosine Cosine similarity Text embeddings, semantic search
Hamming Hamming distance Binary vectors, fingerprints
Jaccard Jaccard distance Set similarity, sparse vectors

Example Workflows

AI Tool with Embeddings Integration

{
  "nodes": [
    {
      "parameters": {
        "model": "text-embedding-3-large",
        "options": {
          "dimensions": 3072
        }
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [784, 624],
      "id": "embeddings",
      "name": "Embeddings OpenAI"
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "repository source",
        "milvusCollection": {
          "__rl": true,
          "value": "gitlab_stemx_source",
          "mode": "name"
        },
        "topK": 10,
        "searchMetricType": "COSINE"
      },
      "type": "n8n-nodes-milvus-enhanced.milvusEnhanced",
      "typeVersion": 1,
      "position": [864, 384],
      "id": "milvus-enhanced",
      "name": "Milvus Enhanced",
      "credentials": {
        "milvusNew": {
          "id": "your-milvus-new-credential-id",
          "name": "Milvus New account"
        }
      }
    },
    {
      "parameters": {
        "authentication": "headerAuth",
        "path": "webhook-path"
      },
      "type": "@n8n/n8n-nodes-langchain.mcpTrigger",
      "typeVersion": 2,
      "position": [816, 32],
      "id": "mcp-trigger",
      "name": "MCP Server Trigger"
    }
  ],
  "connections": {
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Milvus Enhanced",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Milvus Enhanced": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}

Insert Documents

{
  "parameters": {
    "mode": "insert",
    "milvusCollection": {
      "__rl": true,
      "value": "my_collection",
      "mode": "list"
    },
    "data": [
      {
        "id": 1,
        "vector": [0.1, 0.2, 0.3],
        "text": "Sample document"
      }
    ]
  }
}

Create Collection with Custom Metric

{
  "parameters": {
    "operation": "createCollection",
    "collection": "embeddings_collection",
    "metricType": "COSINE",
    "dimension": 768,
    "description": "Text embeddings with cosine similarity"
  }
}

Development

Prerequisites

  • Node.js 18+
  • n8n development environment

Local Development

# Clone repository
git clone https://gitlab.com/interticket/it-stemx/ai-source/milvus-n8n-node.git
cd milvus-n8n-node

# Install dependencies
npm install

# Build
npm run build

# Lint
npm run lint

Project Structure

├── credentials/
│   └── MilvusApi.credentials.ts    # Credential configuration
├── nodes/
│   └── MilvusEnhanced/
│       ├── MilvusEnhanced.node.ts  # Main node implementation
│       └── milvus.svg              # Node icon
├── dist/                           # Compiled output
├── package.json                    # Package configuration
└── README.md                       # Documentation

Requirements

  • n8n version 1.0.0 or higher
  • Milvus server 2.3.0 or higher

License

MIT License - see LICENSE file for details.

Support

For issues, questions, or contributions:

  • Create an issue in the GitLab repository
  • Check n8n community forums for general n8n questions

Changelog

1.0.0

  • Initial release
  • Support for all major Milvus operations
  • Enhanced metric type switching
  • Complete CRUD functionality

Discussion