Portal Community

When to Use

Document must exist. This operation is a partial update only — it does not create documents. If the document ID does not exist, the operation routes to the error port with a 404. To create-or-update, use document/create with the same ID (Elasticsearch's index API replaces the document if it exists).

Configuration

Connection

FieldRequiredDescription
HostRequiredElasticsearch cluster URL, e.g. https://localhost:9200.
UsernameOptionalElasticsearch username (required if security is enabled).
PasswordOptionalPassword for the specified username.
IgnoreSSLOptionalDefault false. Skip TLS validation. Development use only.

Operation

FieldRequiredDescription
IndexNameRequiredThe index containing the document to update.
DocumentIdRequiredThe _id of the document to update. Supports BizFirst expressions, e.g. {{ $json.orderId }}.
FieldsRequiredJSON object containing only the fields to update. Unspecified fields in the existing document are untouched. Example: {"status": "shipped", "shippedAt": "{{ $now }}"}.

Validation Errors

Error CodeCause
VAL_MISSING_INDEXIndexName is empty.
VAL_MISSING_DOC_IDDocumentId is empty.
VAL_MISSING_FIELDSFields 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.

The _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.