get

edit
client.get({
  id: string,
  index: string,
  type: string,
  stored_fields: string | string[],
  parent: string,
  preference: string,
  realtime: boolean,
  refresh: boolean,
  routing: string,
  _source: string | string[],
  _source_exclude: string | string[],
  _source_include: string | string[],
  version: number,
  version_type: 'internal' | 'external' | 'external_gte' | 'force'
})

Reference

id

string - The document ID

index

string - The name of the index

type

string - The type of the document (use _all to fetch the first document matching the ID across all types)

stored_fields or storedFields

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

parent

string - The ID of the parent document

preference

string - Specify the node or shard the operation should be performed on (default: random)

realtime

boolean - Specify whether to perform the operation in realtime or search mode

refresh

boolean - Refresh the shard containing the document before performing the operation

routing

string - Specific routing value

_source

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

_source_exclude or _sourceExclude

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

_source_include or _sourceInclude

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

version

number - Explicit version number for concurrency control

version_type or versionType

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