Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 757 Bytes

File metadata and controls

33 lines (25 loc) · 757 Bytes
endpoint indices.delete
lang javascript
es_version 9.3
client @elastic/elasticsearch@9.3.0

Elasticsearch 9.3 indices.delete endpoint (JavaScript example)

Use client.indices.delete() to permanently remove an index and all of its documents:

const response = await client.indices.delete({ index: "old_products" });

console.log(`Acknowledged: ${response.acknowledged}`);

This operation is irreversible. The index and all its data are deleted immediately.

Handling missing indices

By default, deleting a non-existent index throws a ResponseError. Use ignore_unavailable to silently skip missing indices:

await client.indices.delete({
  index: "old_products",
  ignore_unavailable: true,
});