get_index
Retrieve index metadata including mappings, settings, and aliases from Elasticsearch clusters to understand data structure and configuration.
Instructions
Returns information (mappings, settings, aliases) about one or more indices.
Args:
index: Name of the index
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | Yes |
Implementation Reference
- src/tools/index.py:15-24 (handler)MCP tool handler for 'get_index'. Decorated with @mcp.tool(), it takes an index name and delegates to the search_client's get_index method to retrieve index information.@mcp.tool() def get_index(index: str) -> Dict: """ Returns information (mappings, settings, aliases) about one or more indices. Args: index: Name of the index """ return self.search_client.get_index(index=index)
- src/tools/index.py:9-44 (registration)IndexTools.register_tools method registers all index-related MCP tools, including 'get_index', by defining them with @mcp.tool() decorators.def register_tools(self, mcp: FastMCP): @mcp.tool() def list_indices() -> List[Dict]: """List all indices.""" return self.search_client.list_indices() @mcp.tool() def get_index(index: str) -> Dict: """ Returns information (mappings, settings, aliases) about one or more indices. Args: index: Name of the index """ return self.search_client.get_index(index=index) @mcp.tool() def create_index(index: str, body: Optional[Dict] = None) -> Dict: """ Create a new index. Args: index: Name of the index body: Optional index configuration including mappings and settings """ return self.search_client.create_index(index=index, body=body) @mcp.tool() def delete_index(index: str) -> Dict: """ Delete an index. Args: index: Name of the index """ return self.search_client.delete_index(index=index)
- src/clients/common/index.py:10-13 (helper)Helper method in IndexClient that implements the core logic for retrieving index information by calling the underlying client's indices.get() method.def get_index(self, index: str) -> Dict: """Returns information (mappings, settings, aliases) about one or more indices.""" return self.client.indices.get(index=index)