delete

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

Delete a typed JSON document from a specific index based on its id.

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

Delete the document /myindex/mytype/1.

await client.delete({
  index: 'myindex',
  type: 'mytype',
  id: '1'
});

Params

waitForActiveShards

String — Sets the number of shard copies that must be active before proceeding with the delete 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)

parent

String — ID of parent document

refresh

String — 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.

Options
  • "true"
  • "false"
  • "wait_for"
  • ""

routing

String — Specific routing value

timeout

DurationString — Explicit operation timeout

ifSeqNo

Number — only perform the delete operation if the last operation that has changed the document has the specified sequence number

ifPrimaryTerm

Number — only perform the delete operation if the last operation that has changed the document has the specified primary term

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

body

Object, JSON — An optional request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

back to top