document/update FormID 20308
Partially update an existing document — only the fields you specify change, all other fields are preserved. The document must already exist; this operation does not create new documents. Routes to the error port if the document is not found.
When to Use
- Status transitions: An order moves from
pendingtoprocessing— update only thestatusandupdatedAtfields without re-indexing the full order object. - Field increment or patch: A product's view count increases, or a user's last-login timestamp is updated — write only the changed fields to minimise document transfer size.
- Sync from source system: A source database record changes; map only the modified columns to Elasticsearch fields and apply a targeted partial update instead of a full re-index.
- Enrichment: A downstream node resolves additional data (e.g. a geo-coordinate from an address) — attach the resolved field to the existing document by updating only that field.
document/create with the same ID (Elasticsearch's index API replaces the document if it exists).
Configuration
Connection
| Field | Required | Description |
|---|---|---|
Host | Required | Elasticsearch cluster URL, e.g. https://localhost:9200. |
Username | Optional | Elasticsearch username (required if security is enabled). |
Password | Optional | Password for the specified username. |
IgnoreSSL | Optional | Default false. Skip TLS validation. Development use only. |
Operation
| Field | Required | Description |
|---|---|---|
IndexName | Required | The index containing the document to update. |
DocumentId | Required | The _id of the document to update. Supports BizFirst expressions, e.g. {{ $json.orderId }}. |
Fields | Required | JSON object containing only the fields to update. Unspecified fields in the existing document are untouched. Example: {"status": "shipped", "shippedAt": "{{ $now }}"}. |
Validation Errors
| Error Code | Cause |
|---|---|
VAL_MISSING_INDEX | IndexName is empty. |
VAL_MISSING_DOC_ID | DocumentId is empty. |
VAL_MISSING_FIELDS | Fields is null or contains no entries. |
Output
Success Port
Returns the Elasticsearch update response. Key fields include the updated document's _id, _index, _version (incremented), and result ("updated").
Error Port
Fires when the document does not exist (404), a field type conflict occurs, authentication fails, or a network error occurs. The error output contains errorCode and message fields.
_version field in the success response increments by 1 on every update. You can use this for optimistic concurrency — read the current version with document/get, then pass it as an if_seq_no / if_primary_term parameter if you need conflict detection at the Elasticsearch API level.
Examples
Update Order Status
{
"resource": "document",
"operation": "update",
"IndexName": "orders",
"DocumentId": "{{ $json.orderId }}",
"Fields": {
"status": "{{ $json.newStatus }}",
"updatedAt": "{{ $now }}"
}
}
Only status and updatedAt change. All other order fields (customer, items, total, etc.) are preserved as-is.
Enrich Document with Resolved Data
{
"resource": "document",
"operation": "update",
"IndexName": "customers",
"DocumentId": "{{ $json.customerId }}",
"Fields": {
"geo": {
"lat": "{{ $output.geoLookup.latitude }}",
"lon": "{{ $output.geoLookup.longitude }}"
},
"geoResolvedAt": "{{ $now }}"
}
}
Attaches geo coordinates resolved by a previous node (geoLookup) to the customer document without overwriting any other fields.
Increment a Counter Field
{
"resource": "document",
"operation": "update",
"IndexName": "articles",
"DocumentId": "{{ $json.articleId }}",
"Fields": {
"viewCount": "{{ $output.getArticle._source.viewCount + 1 }}",
"lastViewedAt": "{{ $now }}"
}
}
Read the current value with document/get first, then write the incremented value back. For high-concurrency counters, consider Elasticsearch's scripted update via the REST API directly.