Skip to main content
Glama
Akhilvis

Elastic MCP

by Akhilvis

search_index

Search an Elasticsearch index using a query string to retrieve data from Elasticsearch clusters through the Model Context Protocol.

Instructions

Search an Elasticsearch index with a simple query string.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYes
queryYes

Implementation Reference

  • The handler function for the 'search_index' tool, decorated with @mcp.tool() for registration. It performs a search on an Elasticsearch index using the provided query string and returns the response or an error dictionary.
    @mcp.tool()
    def search_index(index: str, query: str) -> dict:
        """Search an Elasticsearch index with a simple query string."""
        try:
            resp = es.search(index=index, query={"query_string": {"query": query}})
            return resp
        except Exception as e:
            logger.error(f"Error searching index '{index}': {e}")
            return {"error": str(e)}
Install Server

Other Tools

Latest Blog Posts

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/Akhilvis/elastic-mcp'

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