Actions4
- Document Actions
Document → Create or Update
AI-generatedSummary
Upserts one or many documents into a named Upstash Search index, creating each document if its ID is new or overwriting it if it exists. Runs once per input item and returns the Upstash status response.
Inputs
- Index Name (required) — Name of the Upstash Search index to write to. Defaults to "default".
- Upsert Mode — "Single Document" (default) uses the ID, Content and Metadata fields. "Batch (JSON)" upserts an array of documents in one call.
- Document ID (required) — Single mode only. Unique ID of the document. An existing ID is updated.
- Content (JSON) (required) — Single mode only. The document content as a JSON object. A string value is parsed with JSON.parse.
- Metadata (JSON) — Single mode only. Optional metadata as a JSON object. A string value is parsed, and an empty value becomes {}.
- Documents (JSON) (required) — Batch mode only. A JSON array of document objects passed as-is to the Upstash upsert call. Each object should follow the Upstash shape, with id, content and optional metadata.
Output shape
One output item per input item, with the form { status:
Invalid JSON in the content, metadata or documents fields throws a parse error. If Continue On Fail is enabled, the item becomes { error: message } instead. Batch mode returns a single status item per input item, not one per document. Credentials (URL and token) come from the upstashSearchApi credential.
Examples
Example 1: Index a single article from a previous node's data.
Index Name: articles; Upsert Mode: Single Document; Document ID: {{$json.id}}; Content: {"title": "{{$json.title}}", "body": "{{$json.body}}"}; Metadata: {"source": "cms"}.
Example 2: Bulk load a prepared list of documents.
Upsert Mode: Batch (JSON); Documents (JSON): [{"id":"1","content":{"text":"Hello"}},{"id":"2","content":{"text":"World"}}].