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,
  timestamp: string,
  ttl: string,
  version: number,
  version_type: 'internal' | 'external' | 'external_gte' | 'force',
  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

timestamp

string - Explicit timestamp for the document

ttl

string - Expiration time for the document

version

number - Explicit version number for concurrency control

version_type or versionType

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

pipeline

string - The pipeline id to preprocess incoming documents with

body

object - The document