Ignition 8.3+ Gateway Module

Vector search,
inside the
gateway itself.

A first-of-kind Ignition module that exposes system.pgvector directly in the scripting environment — embedding storage, similarity search, and generation, backed by pgvector on PostgreSQL, with no external service call required.

Ignition 8.3+ PostgreSQL 16+ pgvector 0.8.3+ Free module
Gateway Event Script
# store a runbook entry, embed async system.pgvector.embedAndStore( connectionName="mydb", table="runbook_entries", id="runbook-pump-cavitation", text="Pump cavitation detected.", metadata={"severity": "warning"}, async=True ) # find similar alarms results = system.pgvector.querySimilar( "mydb", "alarm_vectors", query_vec, limit=5 ) >>> alarm-001 distance=0.006

Gateway-scope scripting API

Create tables, store vectors, and query by similarity directly from gateway event, scheduled, and tag scripts.

Three embedding providers

OpenAI, Azure OpenAI, or local Ollama — or skip generation entirely and store your own pre-computed vectors.

Async by default

embedAndStore fires through a bounded worker queue so gateway scripts never block on an embedding API call.

Zero-restart configuration

A gateway web UI and REST settings endpoint apply provider changes immediately — no service restart.

Why It Exists

SCADA platforms and vector search don't normally meet.

Every other path to similarity search from an Ignition gateway means standing up an external service and calling out to it from Jython. This module collapses that into a single native scripting namespace.

Without system.pgvector

  • Stand up and maintain a separate vector database service
  • Call out over HTTP from gateway scripts, with its own latency and failure modes
  • Hand-roll embedding queueing so scripts don't block on API calls
  • Manage a second set of credentials and connection config outside Ignition

With system.pgvector

  • Vector storage lives in the same PostgreSQL datasource Ignition already uses
  • One scripting namespace — system.pgvector.* — available wherever gateway scripts run
  • Async embedding queue built in, with configurable worker concurrency
  • Provider and connection settings reconfigure live from the gateway web UI

How It Works

Configure once, script everywhere.

01 / Configure ⚙️

Point at a datasource

Set the Ignition connection name and embedding provider from the gateway web UI at /res/pgvector/index.html. Applies immediately, no restart.

02 / Ensure 🗄️

Create the table

ensureTable creates the vector column and an IVFFlat cosine index if they don't already exist — safe to call on every gateway startup.

03 / Store 📥

Embed and upsert

embedAndStore generates the embedding and upserts by ID, non-blocking by default via a 500-task worker queue.

04 / Query 🔍

Search by similarity

querySimilar returns nearest neighbours ordered by distance, with a choice of cosine, L2, or inner-product metrics.

Scripting API

system.pgvector — gateway scope only.

Available in gateway event scripts, scheduled scripts, and tag scripts. Not exposed in the Designer or Client Script Console.

ensureTable(connectionName, table, dimension=1536)

Creates the vector table and IVFFlat index if they don't already exist. Safe to call on every gateway startup.

upsertEmbedding(connectionName, table, id, embedding, metadata)

Inserts or updates a vector record via ON CONFLICT (id) DO UPDATE — repeated calls with the same ID overwrite vector and metadata.

querySimilar(connectionName, table, embedding, limit=5, distanceMetric="cosine")

Returns the nearest neighbours to a query vector as a list of {id, distance, metadata} dicts, ordered by distance ascending.

generateEmbedding(text)

Calls the configured embedding provider synchronously and returns the vector. Throws if the provider is set to None.

embedAndStore(connectionName, table, id, text, metadata, async=True)

Generates an embedding for text and upserts it. Async by default via the internal queue; set async=False to block.

deleteEmbedding(connectionName, table, id)

Deletes a single vector record by ID.

Embedding Providers

Bring a provider, or bring your own vectors.

OpenAI

text-embedding-3-small (1536-dim) or text-embedding-3-large (3072-dim). API key from platform.openai.com.

Azure OpenAI

Endpoint is your resource URL; model is your deployment name. API key from the Azure resource.

Ollama (local)

Points at a local Ollama endpoint — e.g. nomic-embed-text (768-dim). No API key required.

None (manual)

Use upsertEmbedding with your own pre-computed float arrays. generateEmbedding and embedAndStore throw if called.

Distance Metrics

Three metrics, one function argument.

Metric stringpgvector operatorUse when
cosine (default)<=>Normalized embeddings, semantic similarity
l2 / euclidean<->Absolute magnitude matters
inner_product / dot<#>Already-normalized unit vectors — fastest

REST API

Settings, reachable outside the Designer.

Routes are mounted at /data/pgvector/. Useful for scripting configuration changes from outside Ignition, or wiring settings into an internal admin tool.

GET /data/pgvector/settings
POST /data/pgvector/settings
DEL /data/pgvector/settings
GET /data/pgvector/datasources

GET /data/pgvector/settings

{ "exists": true, "connectionName": "mydb", "embeddingProviderType": "OPENAI", "embeddingModel": "text-embedding-3-small", "embeddingDimension": 1536, "queueWorkerThreads": 2 }

Installation

Three steps, mostly scripted.

01

Install the pgvector PostgreSQL extension

The install script detects or installs VS 2022 Build Tools, clones pgvector v0.8.3, builds it with nmake, and installs it into your PostgreSQL directory.

scripts\install-pgvector-windows.ps1
02

Install the Ignition module

Copies the built .modl into Ignition's user-lib\modules directory and restarts the service.

scripts\install-module-ignition.ps1
03

Accept the unsigned module

In the Gateway web interface, go to Config → Modules and accept the unsigned module prompt. Then configure the datasource and provider at /res/pgvector/index.html.

Get in touch

Bring vector search to the gateway you already run.

Distributed as a free module — no Ignition license required. Happy to walk through the install or the scripting API for a specific use case.

eric.e.fredericksen@gmail.com ← Back to portfolio