Skip to main content
Glama
cloudsmithy

Easysearch MCP Server

by cloudsmithy

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
EASYSEARCH_URLNoEasysearch 地址https://localhost:9200
EASYSEARCH_USERNo用户名admin
EASYSEARCH_PASSWORDNo密码

Tools

Functions exposed to the LLM to take actions

NameDescription
cluster_health
获取集群健康状态 参数: index: 指定索引(可选) level: 详细级别 cluster/indices/shards(可选) 返回集群名称、状态(green/yellow/red)、节点数、分片数等
cluster_stats
获取集群统计信息 参数: node_id: 指定节点 ID(可选) 返回文档数、存储大小、索引数量、节点信息等
cluster_state
获取集群状态 参数: metric: 指标类型 version/master_node/nodes/routing_table/metadata/blocks(可选) index: 指定索引(可选) 返回集群完整状态信息
cluster_settings
获取集群设置 参数: include_defaults: 是否包含默认设置 flat_settings: 是否扁平化显示
cluster_update_settings
更新集群设置 参数: persistent: 持久化设置(重启后保留) transient: 临时设置(重启后丢失) 示例: cluster_update_settings( persistent={"cluster.routing.allocation.enable": "all"} )
cluster_pending_tasks

获取集群待处理任务列表

cluster_allocation_explain
解释分片分配决策 参数: index: 索引名称(可选,不传则解释第一个未分配分片) shard: 分片编号 primary: 是否主分片 用于诊断分片为什么未分配或分配到特定节点
cluster_reroute
手动重新路由分片 参数: commands: 路由命令列表 dry_run: 是否仅模拟执行 示例 - 移动分片: cluster_reroute(commands=[{ "move": { "index": "test", "shard": 0, "from_node": "node1", "to_node": "node2" } }]) 示例 - 取消分片: cluster_reroute(commands=[{ "cancel": {"index": "test", "shard": 0, "node": "node1"} }])
index_create
创建索引 参数: index: 索引名称 mappings: 字段映射定义 settings: 索引设置(分片数、副本数等) aliases: 别名定义 示例: index_create("products", mappings={"properties": {"name": {"type": "text"}, "price": {"type": "float"}}}, settings={"number_of_shards": 3, "number_of_replicas": 1} )
index_delete
删除索引(危险操作) 参数: index: 索引名称,支持通配符如 logs-*
index_exists
检查索引是否存在 参数: index: 索引名称
index_get
获取索引详情(mappings、settings、aliases) 参数: index: 索引名称,支持通配符
index_get_mapping
获取索引映射 参数: index: 索引名称
index_put_mapping
更新索引映射(只能添加字段,不能修改已有字段) 参数: index: 索引名称 properties: 字段定义 dynamic: 动态映射策略 true/false/strict 示例: index_put_mapping("products", properties={"category": {"type": "keyword"}} )
index_get_settings
获取索引设置 参数: index: 索引名称 include_defaults: 是否包含默认设置
index_put_settings
更新索引设置 参数: index: 索引名称 settings: 设置项 示例: index_put_settings("products", {"index.refresh_interval": "30s"})
index_open
打开索引 参数: index: 索引名称
index_close
关闭索引(关闭后无法读写,但保留数据) 参数: index: 索引名称
index_refresh
刷新索引(使最近写入的文档可搜索) 参数: index: 索引名称(可选,不传则刷新所有)
index_flush
刷新索引到磁盘 参数: index: 索引名称(可选) force: 是否强制刷新
index_forcemerge
强制合并索引段 参数: index: 索引名称(可选) max_num_segments: 合并到的最大段数 only_expunge_deletes: 仅清除已删除文档 注意:这是资源密集型操作,建议在低峰期执行
index_clear_cache
清除索引缓存 参数: index: 索引名称(可选) fielddata: 清除 fielddata 缓存 query: 清除查询缓存 request: 清除请求缓存
index_stats
获取索引统计信息 参数: index: 索引名称(可选) metric: 指标类型 docs/store/indexing/get/search/merge/refresh/flush/warmer/query_cache/fielddata/completion/segments/translog
index_segments
获取索引段信息 参数: index: 索引名称(可选)
index_recovery
获取索引恢复状态 参数: index: 索引名称(可选) active_only: 仅显示进行中的恢复
index_shard_stores
获取分片存储信息 参数: index: 索引名称(可选) status: 状态过滤 green/yellow/red/all
index_set_readonly
设置索引为只读(clone/split/shrink 的前置条件) 参数: index: 索引名称 readonly: True 设为只读,False 取消只读 示例: index_set_readonly("my-index", True) # 设为只读 index_set_readonly("my-index", False) # 取消只读
index_prepare_for_shrink
准备索引用于收缩(shrink 的前置条件) 将索引设为只读,并将所有分片迁移到同一节点 参数: index: 索引名称 target_node: 目标节点名称(可选,不传则使用第一个数据节点)
index_create_with_write_alias
创建带可写别名的索引(rollover 的前置条件) 参数: index: 索引名称(建议使用 name-000001 格式) alias: 别名名称 mappings: 字段映射 settings: 索引设置 示例: index_create_with_write_alias("logs-000001", "logs", mappings={"properties": {"@timestamp": {"type": "date"}}})
index_clone
克隆索引 参数: source: 源索引名称 target: 目标索引名称 settings: 目标索引设置 注意:源索引必须是只读的
index_split
拆分索引(增加分片数) 参数: source: 源索引名称 target: 目标索引名称 settings: 目标索引设置(必须包含 number_of_shards) 注意:新分片数必须是原分片数的倍数
index_shrink
收缩索引(减少分片数) 参数: source: 源索引名称 target: 目标索引名称 settings: 目标索引设置 注意:源索引必须是只读的,且所有分片在同一节点
index_rollover
滚动索引 参数: alias: 别名名称 conditions: 滚动条件 settings: 新索引设置 mappings: 新索引映射 示例: index_rollover("logs", conditions={ "max_age": "7d", "max_docs": 1000000, "max_size": "5gb" })
alias_get
获取别名 参数: name: 别名名称(可选) index: 索引名称(可选)
alias_create
创建别名 参数: index: 索引名称 name: 别名名称 filter: 过滤条件 routing: 路由值 示例: alias_create("logs-2024.01", "logs-current") alias_create("users", "active-users", filter={"term": {"status": "active"}})
alias_delete
删除别名 参数: index: 索引名称 name: 别名名称
alias_actions
批量操作别名 参数: actions: 操作列表 示例 - 原子切换别名: alias_actions([ {"remove": {"index": "logs-old", "alias": "logs"}}, {"add": {"index": "logs-new", "alias": "logs"}} ])
template_get
获取索引模板 参数: name: 模板名称(可选,支持通配符)
template_create
创建索引模板 参数: name: 模板名称 index_patterns: 匹配的索引模式列表 template: 模板内容(mappings、settings、aliases) priority: 优先级 composed_of: 组件模板列表 示例: template_create("logs-template", index_patterns=["logs-*"], template={ "settings": {"number_of_shards": 3}, "mappings": {"properties": {"@timestamp": {"type": "date"}}} }, priority=100 )
template_delete
删除索引模板 参数: name: 模板名称
reindex
重建索引 参数: source: 源配置 {"index": "old-index", "query": {...}} dest: 目标配置 {"index": "new-index"} script: 转换脚本 max_docs: 最大文档数 示例: reindex( source={"index": "old-index"}, dest={"index": "new-index"} )
doc_index
写入文档 参数: index: 索引名称 document: 文档内容 id: 文档 ID(可选,不传则自动生成) refresh: 刷新策略 true/false/wait_for routing: 路由值 示例: doc_index("products", {"name": "iPhone", "price": 999}) doc_index("products", {"name": "iPad", "price": 799}, id="ipad-001")
doc_get
获取文档 参数: index: 索引名称 id: 文档 ID source: 返回的字段列表 source_excludes: 排除的字段列表 routing: 路由值
doc_exists
检查文档是否存在 参数: index: 索引名称 id: 文档 ID routing: 路由值
doc_delete
删除文档 参数: index: 索引名称 id: 文档 ID refresh: 刷新策略 routing: 路由值
doc_update
更新文档 参数: index: 索引名称 id: 文档 ID doc: 部分更新的字段 script: 脚本更新 upsert: 文档不存在时插入的内容 refresh: 刷新策略 示例 - 部分更新: doc_update("products", "1", doc={"price": 899}) 示例 - 脚本更新: doc_update("products", "1", script={ "source": "ctx._source.price -= params.discount", "params": {"discount": 100} })
doc_bulk
批量操作文档 参数: operations: 操作列表,每个操作是 {"action": {...}, "doc": {...}} 格式 refresh: 刷新策略 示例: doc_bulk([ {"index": {"_index": "products", "_id": "1"}, "doc": {"name": "A"}}, {"index": {"_index": "products", "_id": "2"}, "doc": {"name": "B"}}, {"delete": {"_index": "products", "_id": "3"}} ])
doc_bulk_simple
简化的批量写入(仅支持 index 操作) 参数: index: 索引名称 documents: 文档列表 refresh: 刷新策略 示例: doc_bulk_simple("products", [ {"name": "A", "price": 100}, {"name": "B", "price": 200} ])
doc_mget
批量获取文档 参数: docs: 文档列表 [{"_index": "idx", "_id": "1"}, ...] index: 默认索引(与 ids 配合使用) ids: ID 列表(与 index 配合使用) source: 返回的字段列表 示例: doc_mget(docs=[ {"_index": "products", "_id": "1"}, {"_index": "products", "_id": "2"} ]) doc_mget(index="products", ids=["1", "2", "3"])
doc_delete_by_query
按查询删除文档 参数: index: 索引名称 query: 查询条件 refresh: 是否刷新 conflicts: 冲突处理 abort/proceed 示例: doc_delete_by_query("logs", {"range": {"@timestamp": {"lt": "2024-01-01"}}})
doc_update_by_query
按查询更新文档 参数: index: 索引名称 query: 查询条件(可选,不传则匹配所有) script: 更新脚本 refresh: 是否刷新 示例: doc_update_by_query("products", query={"term": {"category": "electronics"}}, script={"source": "ctx._source.on_sale = true"} )
doc_source
仅获取文档 _source(不含元数据) 参数: index: 索引名称 id: 文档 ID source: 返回的字段列表
search
执行搜索查询 参数: index: 索引名称(支持通配符和逗号分隔多个索引) query: DSL 查询条件 size: 返回数量 from_: 起始位置(分页) sort: 排序规则 source: 返回的字段列表 aggs: 聚合定义 highlight: 高亮配置 track_total_hits: 是否精确统计总数 示例 - 全文搜索: search("products", query={"match": {"name": "iPhone"}}) 示例 - 复合查询: search("products", query={ "bool": { "must": [{"match": {"name": "phone"}}], "filter": [{"range": {"price": {"lte": 1000}}}] } }) 示例 - 带排序和分页: search("products", query={"match_all": {}}, sort=[{"price": "desc"}], from_=10, size=10)
search_simple
简单关键词搜索 参数: index: 索引名称 keyword: 搜索关键词 field: 搜索字段(可选,不传则全字段搜索) size: 返回数量 示例: search_simple("products", "iPhone") search_simple("logs", "error", field="message")
search_template
使用搜索模板 参数: index: 索引名称 id: 已存储的模板 ID source: 内联模板 params: 模板参数 示例: search_template("products", id="my-template", params={"query_string": "iPhone"})
msearch
多重搜索(一次请求执行多个搜索) 参数: searches: 搜索列表,每项包含 header 和 body 示例: msearch([ {"header": {"index": "products"}, "body": {"query": {"match": {"name": "iPhone"}}}}, {"header": {"index": "products"}, "body": {"query": {"match": {"name": "iPad"}}}} ])
count
统计文档数量 参数: index: 索引名称 query: 查询条件(可选) 示例: count("products") count("products", query={"term": {"status": "active"}})
validate_query
验证查询语法 参数: index: 索引名称 query: 查询条件 explain: 是否返回详细解释 rewrite: 是否返回重写后的查询
explain
解释文档评分 参数: index: 索引名称 id: 文档 ID query: 查询条件 返回文档为什么匹配/不匹配查询,以及评分计算过程
aggregate
执行聚合查询 参数: index: 索引名称 aggs: 聚合定义 query: 过滤条件(可选) size: 返回文档数(默认 0,仅返回聚合结果) 示例 - 分组统计: aggregate("orders", aggs={ "by_status": {"terms": {"field": "status"}} }) 示例 - 多级聚合: aggregate("orders", aggs={ "by_category": { "terms": {"field": "category"}, "aggs": { "avg_price": {"avg": {"field": "price"}} } } }) 示例 - 日期直方图: aggregate("logs", aggs={ "by_day": { "date_histogram": { "field": "@timestamp", "calendar_interval": "day" } } })
aggregate_simple
简化的聚合查询 参数: index: 索引名称 field: 聚合字段 agg_type: 聚合类型 terms/avg/sum/min/max/cardinality/stats/extended_stats size: 返回桶数量(仅 terms 有效) 示例: aggregate_simple("orders", "status", "terms") aggregate_simple("orders", "amount", "avg") aggregate_simple("users", "email", "cardinality") # 去重计数
scroll_start
开始滚动搜索(用于遍历大量数据) 参数: index: 索引名称 query: 查询条件 size: 每批数量 scroll: 滚动上下文保持时间 sort: 排序规则 返回 scroll_id 用于后续获取
scroll_next
获取下一批滚动结果 参数: scroll_id: 滚动 ID scroll: 滚动上下文保持时间
scroll_clear
清除滚动上下文 参数: scroll_id: 滚动 ID all: 是否清除所有滚动上下文
field_caps
获取字段能力信息 参数: index: 索引名称 fields: 字段列表 返回字段在各索引中的类型和能力
knn_search
K近邻向量搜索 参数: index: 索引名称 field: 向量字段名 query_vector: 查询向量 k: 返回最近邻数量 num_candidates: 候选数量 filter: 过滤条件 示例: knn_search("products", "embedding", [0.1, 0.2, 0.3, ...], k=10)
sql_query
执行 SQL 查询 参数: query: SQL 查询语句 format: 返回格式 json/csv/txt/yaml fetch_size: 每次获取的行数 示例: sql_query("SELECT * FROM products WHERE price > 100 LIMIT 10") sql_query("SELECT category, COUNT(*) FROM products GROUP BY category")
cat_health
获取集群健康状态(简洁格式) 参数: ts: 是否显示时间戳
cat_nodes
获取节点信息 参数: full_id: 是否显示完整节点 ID 返回节点名称、IP、角色、负载、内存使用等
cat_indices
获取索引列表 参数: index: 索引名称/模式(可选) health: 健康状态过滤 green/yellow/red pri: 仅显示主分片统计 sort_by: 排序字段 如 store.size/docs.count order: 排序方向 asc/desc 返回索引名称、健康状态、文档数、存储大小等
cat_shards
获取分片分布信息 参数: index: 索引名称(可选) 返回分片状态、大小、所在节点等
cat_allocation
获取节点磁盘分配信息 参数: node_id: 节点 ID(可选) 返回每个节点的分片数、磁盘使用情况
cat_thread_pool
获取线程池状态 参数: thread_pool: 线程池名称(可选)如 search/write/get 返回各线程池的活跃线程数、队列大小、拒绝数
cat_master

获取当前主节点信息

cat_segments
获取段信息 参数: index: 索引名称(可选) 返回每个分片的段数量、大小、文档数等
cat_count
获取文档计数 参数: index: 索引名称(可选)
cat_recovery
获取分片恢复状态 参数: index: 索引名称(可选) active_only: 仅显示进行中的恢复
cat_pending_tasks

获取待处理的集群任务

cat_aliases
获取别名列表 参数: name: 别名名称(可选)
cat_templates
获取索引模板列表 参数: name: 模板名称(可选)
cat_plugins

获取已安装的插件列表

cat_fielddata
获取 fielddata 内存使用 参数: fields: 字段名(可选,逗号分隔)
cat_nodeattrs

获取节点属性

cat_repositories

获取快照仓库列表

cat_snapshots
获取快照列表 参数: repository: 仓库名称
cat_tasks
获取正在执行的任务 参数: detailed: 是否显示详细信息 parent_task_id: 父任务 ID
nodes_info
获取节点信息 参数: node_id: 节点 ID(可选,逗号分隔多个) metric: 信息类型 settings/os/process/jvm/thread_pool/transport/http/plugins/ingest 返回节点配置、JVM 信息、线程池配置等
nodes_stats
获取节点统计信息 参数: node_id: 节点 ID(可选) metric: 统计类型 indices/os/process/jvm/thread_pool/fs/transport/http/breaker/script/discovery/ingest index_metric: 索引统计类型 docs/store/indexing/get/search/merge/refresh/flush/warmer/query_cache/fielddata/completion/segments/translog 示例: nodes_stats() # 所有统计 nodes_stats(metric="jvm,fs") # JVM 和文件系统 nodes_stats(metric="indices", index_metric="search,indexing") # 搜索和索引统计
nodes_hot_threads
获取节点热点线程 参数: node_id: 节点 ID(可选) threads: 每个节点显示的线程数 interval: 采样间隔 type: 线程类型 cpu/wait/block 用于诊断 CPU 高占用问题
nodes_usage
获取节点功能使用统计 参数: node_id: 节点 ID(可选) metric: 统计类型 rest_actions/aggregations 返回各 API 和聚合的使用次数
nodes_reload_secure_settings
重新加载安全设置 参数: node_id: 节点 ID(可选) secure_settings_password: keystore 密码
snapshot_repo_create
创建快照仓库 参数: name: 仓库名称 type: 仓库类型 fs/s3/hdfs/azure/gcs settings: 仓库设置 示例 - 文件系统仓库: snapshot_repo_create("my_backup", "fs", {"location": "/mount/backups"}) 示例 - S3 仓库: snapshot_repo_create("s3_backup", "s3", { "bucket": "my-bucket", "region": "us-east-1" })
snapshot_repo_get
获取快照仓库信息 参数: name: 仓库名称(可选,支持通配符)
snapshot_repo_delete
删除快照仓库 参数: name: 仓库名称
snapshot_repo_verify
验证快照仓库 参数: name: 仓库名称
snapshot_create
创建快照 参数: repository: 仓库名称 snapshot: 快照名称 indices: 索引列表(可选,不传则备份所有) ignore_unavailable: 忽略不存在的索引 include_global_state: 包含集群状态 wait_for_completion: 等待完成 示例: snapshot_create("my_backup", "snapshot_1") snapshot_create("my_backup", "snapshot_2", indices=["logs-*", "metrics-*"])
snapshot_get
获取快照信息 参数: repository: 仓库名称 snapshot: 快照名称(可选,支持通配符,_all 获取所有) verbose: 是否显示详细信息
snapshot_status
获取快照状态 参数: repository: 仓库名称(可选) snapshot: 快照名称(可选) 返回正在进行的快照的详细进度
snapshot_delete
删除快照 参数: repository: 仓库名称 snapshot: 快照名称
snapshot_restore
恢复快照 参数: repository: 仓库名称 snapshot: 快照名称 indices: 要恢复的索引列表 ignore_unavailable: 忽略不存在的索引 include_global_state: 恢复集群状态 rename_pattern: 重命名模式(正则) rename_replacement: 重命名替换 wait_for_completion: 等待完成 示例 - 恢复并重命名: snapshot_restore("my_backup", "snapshot_1", indices=["logs-*"], rename_pattern="(.+)", rename_replacement="restored_$1" )

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

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/cloudsmithy/easysearch-mcp-server'

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