put_alias
Create or update an alias for an Elasticsearch index to simplify index management and reference documents.
Instructions
Create or update an alias for a specific index.
Args:
index: Name of the index
name: Name of the alias
body: Alias configuration
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | Yes | ||
| name | Yes | ||
| body | Yes |
Implementation Reference
- src/tools/alias.py:24-34 (handler)MCP tool handler function for 'put_alias'. Registers the tool and implements the logic by delegating to the search client's put_alias method. The docstring provides input schema.@mcp.tool() def put_alias(index: str, name: str, body: Dict) -> Dict: """ Create or update an alias for a specific index. Args: index: Name of the index name: Name of the alias body: Alias configuration """ return self.search_client.put_alias(index=index, name=name, body=body)
- src/clients/common/alias.py:14-16 (helper)The underlying client method that performs the actual Elasticsearch/OpenSearch put_alias API call.def put_alias(self, index: str, name: str, body: Dict) -> Dict: """Creates or updates an alias.""" return self.client.indices.put_alias(index=index, name=name, body=body)
- src/server.py:44-53 (registration)Registration of AliasTools class in the main server, which leads to instantiation and calling register_tools to define and register the put_alias tool.tool_classes = [ IndexTools, DocumentTools, ClusterTools, AliasTools, DataStreamTools, GeneralTools, ] # Register all tools register.register_all_tools(tool_classes)
- src/tools/register.py:33-35 (helper)Instantiation of AliasTools with search_client and preparation for registration, including risk management setup.for tool_class in tool_classes: self.logger.info(f"Registering tools from {tool_class.__name__}") tool_instance = tool_class(self.search_client)