get_document
Retrieve a specific document by its ID and index from Elasticsearch clusters. Ideal for targeted data extraction and document access in Elasticsearch environments.
Instructions
Get a document by ID.
Args:
index: Name of the index
id: Document ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| index | Yes |
Implementation Reference
- src/tools/document.py:33-42 (handler)MCP tool handler for 'get_document'. Decorated with @mcp.tool(), delegates to search_client.get_document.@mcp.tool() def get_document(index: str, id: str) -> Dict: """ Get a document by ID. Args: index: Name of the index id: Document ID """ return self.search_client.get_document(index=index, id=id)
- src/clients/common/document.py:26-29 (helper)Underlying implementation in DocumentClient that calls the search client.get method.def get_document(self, index: str, id: str) -> Dict: """Get a document by ID.""" return self.client.get(index=index, id=id)
- src/server.py:44-53 (registration)Registration point where DocumentTools class is included in the list of tools to register via ToolsRegister.register_all_tools.tool_classes = [ IndexTools, DocumentTools, ClusterTools, AliasTools, DataStreamTools, GeneralTools, ] # Register all tools register.register_all_tools(tool_classes)