Elasticsearch

Elasticsearch

Let your AI explore and query your Elasticsearch cluster on Elastic Cloud, Serverless or your own servers: list indices and data streams, read mappings, search, aggregate, count, run ES|QL and, with your confirmation, write documents.

7-day free trial · No credit card · EU-hosted

Ask Elasticsearch anything

Try a real prompt against Elasticsearch via AnythingMCP — Claude calls the tools, returns the answer. Press Enter on your own message to install on Cloud.

Install Elasticsearch on Cloud
Elasticsearch · live via MCP
Share
Opus 4.7

Claude is AI and can make mistakes. Please double-check responses.

Setup in 2 minutes

  1. 1Start a free trial on cloud.anythingmcp.com.
  2. 2Click Elasticsearch in the connector store. Paste credentials when prompted.
  3. 3Mint an MCP API key and point your AI client at the generated MCP URL.
Install Elasticsearch now

Guides for Elasticsearch

Step-by-step setup for the most popular AI clients.

Setting up Elasticsearch

From the connector definition itself: where to find the credentials, what they need to be allowed to do, and which API this adapter talks to.

Elasticsearch

This connector calls the Elasticsearch REST API of the user's own cluster: Elastic Cloud Hosted, Elastic Cloud Serverless or a self-managed cluster. It can list indices, aliases and data streams, read mappings, search with the Query DSL, aggregate, count, run ES|QL queries, read single documents and, when the key allows it, write documents. It talks to Elasticsearch only, not to Kibana.

Setup (about 3 minutes)

  1. Find the Elasticsearch endpoint. Elastic Cloud Hosted: open the deployment in https://cloud.elastic.co and copy the Elasticsearch endpoint (e.g. https://my-deployment.es.europe-west3.gcp.cloud.es.io). Serverless: open the project and copy the Elasticsearch endpoint (e.g. https://my-project-a1b2c3.es.eu-west-1.aws.elastic.cloud). Self-managed: the HTTPS address and port the cluster answers on (e.g. https://search.example.com:9200). It must be reachable from the internet for AnythingMCP Cloud; a self-hosted AnythingMCP can reach a cluster in the same network once an admin allows that host. Paste it into ELASTICSEARCH_URL without a trailing slash.
  2. Create an API key. In Kibana: Stack Management > API keys > Create API key (Serverless: project settings > API keys). Give it a name such as anythingmcp and an expiry, and turn on Control security privileges to limit it (see below). Copy the Encoded value (base64, it ends in = in most cases): Elastic shows it only once. Paste it into ELASTICSEARCH_API_KEY. It is sent as Authorization: ApiKey <encoded>. Username and password (basic auth) are not supported by this connector; create an API key instead.

Read-only key (recommended): use these role descriptors in the Kibana form, or run this in Kibana Dev Tools while signed in as a user who may create keys:

POST /_security/api_key
{
  "name": "anythingmcp-read",
  "expiration": "365d",
  "role_descriptors": {
    "anythingmcp_read": {
      "cluster": ["monitor"],
      "indices": [
        { "names": ["*"], "privileges": ["read", "view_index_metadata", "monitor"] }
      ]
    }
  }
}

Copy encoded from the answer. Replace "*" with the index patterns the AI may see (e.g. ["products", "logs-*"]). read covers search, count, aggregations, ES|QL and single documents; view_index_metadata covers mappings, aliases and data streams; monitor covers the index list; the monitor cluster privilege covers cluster info and health. A key can never have more rights than the user who creates it.

Writes: elasticsearch_index_document and elasticsearch_update_document need write (or index) on the target indices in addition; with the read-only key above they fail with 403, which is the intended safety net. Every write asks the user to confirm first. elasticsearch_delete_document and elasticsearch_delete_by_query are installed switched off; an admin turns them on deliberately, and they need the delete (or write) privilege.

Which tool

  • Orientation: elasticsearch_whoami (who the key belongs to; needs no privileges), elasticsearch_cluster_info, elasticsearch_cluster_health (not on Serverless), elasticsearch_list_indices, elasticsearch_list_aliases, elasticsearch_list_data_streams.
  • Before querying an index, call elasticsearch_get_mapping: field names and types decide the query. text fields take match, keyword fields take term/terms and sort and aggregate; a text field often has a .keyword sub-field for that.
  • elasticsearch_search: Query DSL search, 10 hits by default, at most 100 per call; use source_fields to keep answers small, from or search_after with sort to page.
  • elasticsearch_aggregate: counts per value, sums, averages, date histograms, without documents.
  • elasticsearch_count: just the number of matches.
  • elasticsearch_esql_query: ES|QL for tabular questions (FROM ... | WHERE ... | STATS ... BY ... | SORT ... | LIMIT n); always end with LIMIT, at most 500 rows are passed on. Pass user-supplied values through params with ? placeholders.
  • elasticsearch_get_document: one document by _index and _id.

Vectors: dense vector fields are not useful in a chat. Since Elasticsearch 9.2 new indices leave them out of _source by default; otherwise common names (embedding, vector, ...) are dropped from search output, and source_fields or source_excludes keep others out.

Errors: 401 means the API key is wrong, expired or invalidated. 403 security_exception ... is unauthorized names the privilege the key lacks. 404 index_not_found_exception is an unknown index name (check elasticsearch_list_indices). 400 parsing_exception or verification_exception (ES|QL) points at the query; the message names the field or position. 429 means the cluster is overloaded; wait and retry.

Out of scope here: Kibana (dashboards, saved objects), creating or deleting indices, changing mappings or settings, snapshots, ingest pipelines, security administration and the bulk API.

Your AI is two clicks away from Elasticsearch.

Install the connector, paste your credentials, ask your AI a question. 7-day free trial, no credit card.