delete_index_template
Remove specific Elasticsearch index templates by name to manage and organize data storage structures effectively within the Elasticsearch MCP Server.
Instructions
Delete an Elasticsearch index template
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the template to delete |
Implementation Reference
- src/tools/createIndexTemplate.ts:122-152 (handler)The main handler function that executes the delete index template logic using Elasticsearch client.export async function deleteIndexTemplate( esClient: Client, name: string ) { try { const response = await esClient.indices.deleteIndexTemplate({ name }); return { content: [ { type: "text" as const, text: response.acknowledged ? `Index template "${name}" deleted successfully.` : `Index template delete request sent, but not acknowledged. Check cluster status.` } ] }; } catch (error) { console.error(`Delete index template failed: ${error instanceof Error ? error.message : String(error)}`); return { content: [ { type: "text" as const, text: `Error: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
- src/server.ts:277-290 (registration)Registers the 'delete_index_template' tool with the MCP server, defining the input schema and linking to the handler function.server.tool( "delete_index_template", "Delete an Elasticsearch index template", { name: z .string() .trim() .min(1, "Template name is required") .describe("Name of the template to delete") }, async ({ name }) => { return await deleteIndexTemplate(esClient, name); } );
- src/server.ts:280-286 (schema)Zod schema for the input parameter 'name' of the delete_index_template tool.{ name: z .string() .trim() .min(1, "Template name is required") .describe("Name of the template to delete") },