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 天免费 · 无需信用卡 · EU 托管

问 Elasticsearch 任何事

通过 AnythingMCP 对 Elasticsearch 试一个真实提示 — Claude 调用工具并返回答案。在你的消息上按 Enter 即可在 Cloud 安装。

在 Cloud 上安装 Elasticsearch
Elasticsearch · 通过 MCP 实时
分享
Opus 4.7

Claude 是 AI,可能会出错。请核对回答。

2 分钟设置

  1. 1在 cloud.anythingmcp.com 开始免费试用。
  2. 2在连接器商店点击 Elasticsearch。提示时粘贴凭据。
  3. 3生成 MCP API 密钥,将 AI 客户端指向生成的 MCP URL。
立即安装 Elasticsearch

Elasticsearch 指南

面向主流 AI 客户端的逐步设置。

配置 Elasticsearch

直接来自连接器定义:在哪里获取凭据、需要哪些权限,以及该适配器调用的是哪个 API。 由连接器作者以英文提供。

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.

你的 AI 距离 Elasticsearch 仅两次点击。

安装连接器、粘贴凭据、向 AI 提问。7 天免费,无需信用卡。