index

edit
client.index({
  id: string,
  index: string,
  type: string,
  wait_for_active_shards: string,
  op_type: 'index' | 'create',
  parent: string,
  refresh: 'true' | 'false' | 'wait_for',
  routing: string,
  timeout: string,
  version: number,
  version_type: 'internal' | 'external' | 'external_gte' | 'force',
  if_seq_no: number,
  if_primary_term: number,
  pipeline: string,
  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 index 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)

op_type or opType

'index' | 'create' - Explicit operation type
Default: index

parent

string - ID of the parent document

refresh

'true' | 'false' | 'wait_for' - If true then refresh the affected 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.

routing

string - Specific routing value

timeout

string - Explicit operation timeout

version

number - Explicit version number for concurrency control

version_type or versionType

'internal' | 'external' | 'external_gte' | 'force' - Specific version type

if_seq_no or ifSeqNo

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

if_primary_term or ifPrimaryTerm

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

pipeline

string - The pipeline id to preprocess incoming documents with

body

object - The document