younifyd
Menu

Update a document

Update a document

POST/{index}/_update/{id}

Use it in a workflow

  1. Add a step and choose the Elasticsearch connector.
  2. Pick the Update a document action (under document).
  3. Fill in the fields below, then reference the result from later steps as {{updateADocument.response.data}}.

Request

Path parameters

indexstringrequired

The name of the target index. By default, the index is created automatically if it doesn't exist.

idstringrequired

A unique identifier for the document to be updated.

Query parameters

if_primary_termnumber

Only perform the operation if the document has this primary term.

if_seq_nonumber

Only perform the operation if the document has this sequence number.

include_source_on_errorboolean

True or false if to include the document source in the error message in case of parsing errors.

langstring

The script language.

refreshstring

If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. If 'wait_for', it waits for a refresh to make this operation visible to search. If 'false', it does nothing with refreshes.

One oftruefalsewait_for

require_aliasboolean

If `true`, the destination must be an index alias.

retry_on_conflictnumber

The number of times the operation should be retried when a conflict occurs.

routingoneOf

A custom value used to route operations to a specific shard.

timeoutoneOf

The period to wait for the following operations: dynamic mapping updates and waiting for active shards. Elasticsearch waits for at least the timeout period before failing. The actual wait time could be longer, particularly when multiple waits occur.

wait_for_active_shardsoneOf

The number of copies of each shard that must be active before proceeding with the operation. Set to 'all' or any positive integer up to the total number of shards in the index (`number_of_replicas`+1). The default value of `1` means it waits for each primary shard to be active.

_sourceoneOf

If `false`, source retrieval is turned off. You can also specify a comma-separated list of the fields you want to retrieve.

_source_excludesoneOf

The source fields you want to exclude.

_source_includesoneOf

The source fields you want to retrieve.

Request body

Enter the body as JSON in the step's Body field.

detect_noopboolean

If `true`, the `result` in the response is set to `noop` (no operation) when there are no changes to the document.

Default true

docobject

A partial update to an existing document. If both `doc` and `script` are specified, `doc` is ignored.

doc_as_upsertboolean

If `true`, use the contents of 'doc' as the value of 'upsert'. NOTE: Using ingest pipelines with `doc_as_upsert` is not supported.

Default false

scriptany

The script to run to update the document.

scripted_upsertboolean

If `true`, run the script whether or not the document exists.

Default false

_sourceany

If `false`, turn off source retrieval. You can also specify a comma-separated list of the fields you want to retrieve.

Default "true"

upsertobject

If the document does not already exist, the contents of 'upsert' are inserted as a new document. If the document exists, the 'script' is run.

json
{
  "detect_noop": true,
  "doc": {},
  "doc_as_upsert": false,
  "script": null,
  "scripted_upsert": false,
  "_source": "true",
  "upsert": {}
}

Response

Returns 200 with a any. Read it in later steps with {{updateADocument.response.data.<field>}}.

Need more? See the Elasticsearch guide for connection setup and behaviour shared by every action.

Update a document — Elasticsearch — Documentation