update

edit
client.update({
  id: string,
  index: string,
  type: string,
  wait_for_active_shards: string,
  fields: string | string[],
  _source: string | string[],
  _source_excludes: string | string[],
  _source_includes: string | string[],
  lang: string,
  parent: string,
  refresh: 'true' | 'false' | 'wait_for',
  retry_on_conflict: number,
  routing: string,
  timeout: string,
  if_seq_no: number,
  if_primary_term: number,
  version: number,
  version_type: 'internal' | 'force',
  body: object
})

Reference

id

string - Document ID

index

string - The name of the index

type

string - The type of the document

wait_for_active_shards or waitForActiveShards

string - Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

fields

string | string[] - A comma-separated list of fields to return in the response

_source

string | string[] - True or false to return the _source field or not, or a list of fields to return

_source_excludes or _sourceExcludes

string | string[] - A list of fields to exclude from the returned _source field

_source_includes or _sourceIncludes

string | string[] - A list of fields to extract and return from the _source field

lang

string - The script language (default: painless)

parent

string - ID of the parent document. Is is only used for routing and when for the upsert request

refresh

'true' | 'false' | 'wait_for' - If true then refresh the effected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes.

retry_on_conflict or retryOnConflict

number - Specify how many times should the operation be retried when a conflict occurs (default: 0)

routing

string - Specific routing value

timeout

string - Explicit operation timeout

if_seq_no or ifSeqNo

number - only perform the update operation if the last operation that has changed the document has the specified sequence number

if_primary_term or ifPrimaryTerm

number - only perform the update operation if the last operation that has changed the document has the specified primary term

version

number - Explicit version number for concurrency control

version_type or versionType

'internal' | 'force' - Specific version type

body

object - The request definition requires either script or partial doc