get

edit
client.get([params, [callback]])

Get a typed JSON document from the index based on its id.

Check the API Conventions and the elasticsearch docs for more information pertaining to this method.

Get /myindex/mytype/1.

const response = await client.get({
  index: 'myindex',
  type: 'mytype',
  id: 1
});

Params

storedFields

String, String[], Boolean — 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[], Boolean — True or false to return the _source field or not, or a list of fields to return

_sourceExcludes

String, String[], Boolean — A list of fields to exclude from the returned _source field

_sourceIncludes

String, String[], Boolean — A list of fields to extract and return from the _source field

version

Number — Explicit version number for concurrency control

versionType

String — Specific version type

Options
  • "internal"
  • "external"
  • "external_gte"
  • "force"

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)

back to top