Vector Store icon

Vector Store

Store, search and manage vectors on the n8n host filesystem via js-vector-store

Upsert

AI-generated

Summary

Upserts a vector under an ID in the selected collection, storing optional metadata. If Text is non-empty, also adds the text to the collection’s BM25 index for hybrid search.

Inputs

  • Read Only — Defaults to false. When enabled, rejects this write operation before it runs.
  • Collection (required) — Name of the collection to write to.
  • ID (required) — ID used to insert or update the vector.
  • Vector (required) — Array of finite numbers or a JSON string containing one. Its length must match the dimension configured in the credentials.
  • Metadata — Optional JSON object, supplied as a string, to store with the vector. Blank input stores an empty object.
  • Text — Optional text to add to the collection’s BM25 lexical index for hybrid search. Blank input skips BM25 indexing.

Output shape

A single n8n item containing a JSON object.

The output includes the collection name, ID, and upserted: true. The vector store is flushed after the write; invalid vector dimensions or JSON input cause an error.

Examples

Example 1: Upsert a vector with optional fields

Set Collection and ID, supply a numeric vector matching the configured credential dimension, and optionally provide metadata as a JSON object string and text for hybrid search.

Example 2: Upsert a vector without BM25 text indexing

Leave Text blank. The operation writes the vector and optional metadata without adding a BM25 document.

Links

Discussion