Snap.Bulk.Action.Update (Snap v0.17.0)

Copy Markdown View Source

Represents an update step in a Snap.Bulk operation.

Updates an existing document, returning an error if it does not exist, unless an upsert is configured.

Supports the following action fields:

  • index - the index to write to, if not specified on the bulk operation
  • id - the document ID to update
  • require_alias - when true, the destination must be an index alias
  • routing - the custom routing value for the document
  • if_seq_no - only perform the action if the document has this sequence number
  • if_primary_term - only perform the action if the document has this primary term
  • retry_on_conflict - how many times to retry the update if a version conflict occurs
  • pipeline - the ingest pipeline to run an upserted document through
  • source - which parts of the updated _source to return

Note that updates do not support version/version_type. Use if_seq_no and if_primary_term instead.

Along with the following document fields:

  • doc - the partial document to merge into the existing one
  • doc_as_upsert - when true, doc is indexed if the document does not already exist
  • script - a script to run against the existing document, instead of doc
  • upsert - the document to index if it does not already exist
  • scripted_upsert - when true, script is run against upsert when the document does not already exist
  • detect_noop - when false, the document is always reindexed, even if doc makes no changes to it

Summary

Types

t()

@type t() :: %Snap.Bulk.Action.Update{
  detect_noop: boolean() | nil,
  doc: map() | nil,
  doc_as_upsert: boolean() | nil,
  id: String.t() | nil,
  if_primary_term: integer() | nil,
  if_seq_no: integer() | nil,
  index: String.t() | nil,
  pipeline: String.t() | nil,
  require_alias: boolean() | nil,
  retry_on_conflict: integer() | nil,
  routing: String.t() | nil,
  script: map() | nil,
  scripted_upsert: boolean() | nil,
  source: Snap.Bulk.Action.source() | nil,
  upsert: map() | nil
}