Skip to main content
Glama

Elasticsearch MCP Server

getMappings.ts933 B
import { Client } from "@elastic/elasticsearch"; export async function getMappings(esClient: Client, index: string) { try { const mappingResponse = await esClient.indices.getMapping({ index, }); return { content: [ { type: "text" as const, text: `Index mapping: ${index}`, }, { type: "text" as const, text: `Index ${index} mapping: ${JSON.stringify( mappingResponse[index]?.mappings || {}, null, 2 )}`, }, ], }; } catch (error) { console.error( `Failed to get mapping: ${ error instanceof Error ? error.message : String(error) }` ); return { content: [ { type: "text" as const, text: `Error: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/awesimon/elasticsearch-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server