Skip to content

elasticsearch delete-document

delete document from index

Description

Removes a JSON document from the specified index.

Synopsis

elasticsearch delete-document
    [--site <site>]
    [--cluster <cluster>]
    --index <index>
    <id>

Arguments

site - (string)

     Site where this command will be executed
     Example: --site "site-1"
     Default: input.site      Attributes: optional

cluster - (string)

     Name of elastic search cluster
     Example: --cluster "elastic-default"
     Default: elastic-default      Attributes: optional

index - (string)

     Name of the index that contains the document.
     Example: --index "students"
     Default: _None_      Attributes: required

id - (int)

     Unique identifier of the document.
     Example: 1
     Default: _None_      Attributes: required

Examples

Input:

! elasticsearch delete-document --cluster "elastic-1" --index "my-index-000001" 1
Output:
{
  "_index": "my-index-000001",
  "_type": "_doc",
  "_id": "1",
  "_version": 3,
  "result": "deleted",
  "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
  },
  "_seq_no": 2,
  "_primary_term": 1
}

Access Control

To use this command, you need access to the following:

Field Value
Action "update"
Service Type "elasticsearch"
Service Instance cluster
Namespace
Object Type "index"
Object ID index

Please see Access Control for details.