Gmail to Vector Embeddings with PGVector & Ollama

Ingests Gmail emails into Postgres with pgvector for vector embeddings using local Ollama. Enables semantic searches on email history while storing structured data.

n8n
Gmail to Vector Embeddings with PGVector & Ollama

This workflow automates the extraction and vectorization of Gmail emails into a Postgres database enhanced with pgvector. It uses the open-source Ollama with nomic-embed-text model for generating embeddings locally, ensuring privacy and no external dependencies. Emails are stored in both structured tables (with metadata like ID, date, sender) and a vector embeddings table, linked by Gmail message ID for hybrid queries.

To use, specify your Gmail account creation date and manually run the workflow to bulk-import historical emails in monthly batches. Once populated, activate the Gmail Trigger node to continuously process new incoming emails. This setup supports semantic similarity searches, allowing queries like 'What hotel did I stay in last summer?' via vector search on email content.

Benefits include 100% local operation for data sovereignty, dual storage for structured and semantic access, and foundation for RAG applications. It saves hours of manual data organization and enables AI-powered insights from email archives without cloud costs.

Ideal use cases: Personal knowledge bases from emails, business email analytics for customer interactions, compliance archiving with search, or integrating with chatbots for querying history (pairs with Telegram RAG workflows). Perfect for users wanting offline AI vector stores.

$22.99
Last updated October 17, 2026
30-day money-back guarantee
Instant download
Lifetime updates included

New buyers can create an account from the cart to unlock a controlled $10 first-purchase credit on eligible orders of $25+.

Secure checkout powered by Stripe

Support

How to import this workflow into n8n

  1. 1Purchase or download the workflow to get the n8n workflow JSON file.
  2. 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
  3. 3Open each node marked with a credential warning and connect your own accounts and API keys.
  4. 4Run the workflow once manually to verify the data flow, then toggle it to Active.

Related Business Operations & ERPs workflows

More from Nadia Ivanov

Need this deployed? We'll set it up for you.

Our automation experts deploy this workflow in your stack, connect your accounts, and verify it works — or build a custom solution from scratch.