Elasticsearch
在 Elasticsearch 中搜索、索引和管理数据
配置
搜索
操作
搜索
部署类型
自托管
Elasticsearch 主机
https://localhost:9200
当 deploymentType 为 'self_hosted' 时显示。
Cloud ID
deployment-name:base64-encoded-data
当 deploymentType 为 'cloud' 时显示。
认证方式
API 密钥
API 密钥
••••••••
当 authMethod 为 'api_key' 时显示。
用户名
输入用户名
当 authMethod 为 'basic_auth' 时显示。
密码
••••••••
当 authMethod 为 'basic_auth' 时显示。
索引名称*
my-index
搜索查询
json
{ "match": { "field": "搜索词" } }
结果数量
10
偏移量
0
排序
json
[{ "field": { "order": "asc" } }]
包含字段
field1, field2(逗号分隔)
排除字段
field1, field2(逗号分隔)
搜索(
elasticsearch_search)使用 Query DSL 在 Elasticsearch 中搜索文档。返回匹配的文档及其评分和元数据。
输入
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
deploymentType | string | 是 | 部署类型:self_hosted 或 cloud |
host | string | 否 | Elasticsearch 主机 URL(自托管部署) |
cloudId | string | 否 | Elastic Cloud ID(云端部署) |
authMethod | string | 是 | 认证方式:api_key 或 basic_auth |
apiKey | string | 否 | Elasticsearch API 密钥 |
username | string | 否 | 基本认证用户名 |
password | string | 否 | 基本认证密码 |
index | string | 是 | 要搜索的索引名称 |
query | string | 否 | JSON 字符串形式的 Query DSL |
from | number | 否 | 分页起始偏移量(默认:0) |
size | number | 否 | 返回结果数量(默认:10) |
sort | string | 否 | JSON 字符串形式的排序规则 |
sourceIncludes | string | 否 | 要包含在 _source 中的字段列表,以逗号分隔 |
sourceExcludes | string | 否 | 要从 _source 中排除的字段列表,以逗号分隔 |
trackTotalHits | boolean | 否 | 跟踪准确的总命中数(默认:true) |
输出
| 参数 | 类型 | 描述 |
|---|---|---|
took | 数字 | 搜索耗时(毫秒) |
timed_out | 布尔值 | 搜索是否超时 |
hits | 对象 | 搜索结果,包含总数和匹配的文档 |
aggregations | JSON | 聚合结果(如有) |
索引文档
操作
索引文档
部署类型
自托管
Elasticsearch 主机
https://localhost:9200
当 deploymentType 为 'self_hosted' 时显示。
Cloud ID
deployment-name:base64-encoded-data
当 deploymentType 为 'cloud' 时显示。
认证方式
API 密钥
API 密钥
••••••••
当 authMethod 为 'api_key' 时显示。
用户名
输入用户名
当 authMethod 为 'basic_auth' 时显示。
密码
••••••••
当 authMethod 为 'basic_auth' 时显示。
索引名称*
my-index
文档 ID
留空以自动生成 ID
文档*
json
{ "field": "value", "another_field": 123 }
刷新
默认
索引文档 (
elasticsearch_index_document)在 Elasticsearch 中索引(创建或更新)文档。
输入
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
deploymentType | string | 是 | 部署类型:self_hosted 或 cloud |
host | string | 否 | Elasticsearch 主机 URL (用于自托管) |
cloudId | string | 否 | Elastic Cloud ID (用于云部署) |
authMethod | string | 是 | 认证方式:api_key 或 basic_auth |
apiKey | string | 否 | Elasticsearch API 密钥 |
username | string | 否 | 基本认证的用户名 |
password | string | 否 | 基本认证的密码 |
index | string | 是 | 目标索引名称 |
documentId | string | 否 | 文档 ID (未提供时自动生成) |
document | string | 是 | 文档正文,JSON 字符串 |
refresh | string | 否 | 刷新策略:true、false 或 wait_for |
输出
| 参数 | 类型 | 描述 |
|---|---|---|
_index | string | 存储文档的索引 |
_id | string | 文档 ID |
_version | number | 文档版本 |
result | string | 操作结果 (已创建或已更新) |
获取文档
操作
获取文档
部署类型
自托管
Elasticsearch 主机
https://localhost:9200
当 deploymentType 为 'self_hosted' 时显示。
Cloud ID
deployment-name:base64-encoded-data
当 deploymentType 为 'cloud' 时显示。
认证方式
API 密钥
API 密钥
••••••••
当 authMethod 为 'api_key' 时显示。
用户名
输入用户名
当 authMethod 为 'basic_auth' 时显示。
密码
••••••••
当 authMethod 为 'basic_auth' 时显示。
索引名称*
my-index
文档 ID*
unique-document-id
包含的字段
field1, field2(逗号分隔)
排除的字段
field1, field2(逗号分隔)
获取文档(
elasticsearch_get_document)根据 ID 从 Elasticsearch 检索文档。
输入
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
deploymentType | string | 是 | 部署类型:self_hosted 或 cloud |
host | string | 否 | Elasticsearch 主机 URL (适用于自托管) |
cloudId | string | 否 | Elastic Cloud ID (适用于云部署) |
authMethod | string | 是 | 认证方式:api_key 或 basic_auth |
apiKey | string | 否 | Elasticsearch API 密钥 |
username | string | 否 | 基本认证的用户名 |
password | string | 否 | 基本认证的密码 |
index | string | 是 | 索引名称 |
documentId | string | 是 | 要检索的文档 ID |
sourceIncludes | string | 否 | 要包含的字段列表,以逗号分隔 |
sourceExcludes | string | 否 | 要排除的字段列表,以逗号分隔 |
输出
| 参数 | 类型 | 说明 |
|---|---|---|
_index | string | 索引名称 |
_id | string | 文档 ID |
_version | number | 文档版本 |
found | boolean | 是否找到该文档 |
_source | json | 文档内容 |
更新文档
操作
更新文档
部署类型
自托管
Elasticsearch 主机
https://localhost:9200
当 deploymentType 为 'self_hosted' 时显示。
Cloud ID
deployment-name:base64-encoded-data
当 deploymentType 为 'cloud' 时显示。
认证方式
API 密钥
API 密钥
••••••••
当 authMethod 为 'api_key' 时显示。
用户名
输入用户名
当 authMethod 为 'basic_auth' 时显示。
密码
••••••••
当 authMethod 为 'basic_auth' 时显示。
索引名称*
my-index
文档 ID*
unique-document-id
部分文档*
json
{ "field_to_update": "new_value" }
冲突时重试
3
更新文档 (
elasticsearch_update_document)使用文档合并部分更新 Elasticsearch 中的文档。
输入
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
deploymentType | string | 是 | 部署类型:self_hosted 或 cloud |
host | string | 否 | Elasticsearch 主机 URL (用于自托管) |
cloudId | string | 否 | Elastic Cloud ID (用于云部署) |
authMethod | string | 是 | 认证方法:api_key 或 basic_auth |
apiKey | string | 否 | Elasticsearch API 密钥 |
username | string | 否 | 基本认证的用户名 |
password | string | 否 | 基本认证的密码 |
index | string | 是 | 索引名称 |
documentId | string | 是 | 要更新的文档 ID |
document | string | 是 | 要合并为 JSON 字符串的部分文档 |
retryOnConflict | number | 否 | 版本冲突时的重试次数 |
输出
| 参数 | 类型 | 描述 |
|---|---|---|
_index | string | 索引名称 |
_id | string | 文档 ID |
_version | number | 新文档版本 |
result | string | 操作结果 (updated 或 noop) |
删除文档
操作
删除文档
部署类型
自托管
Elasticsearch 主机
https://localhost:9200
当 deploymentType 为 'self_hosted' 时显示。
Cloud ID
deployment-name:base64-encoded-data
当 deploymentType 为 'cloud' 时显示。
认证方法
API 密钥
API 密钥
••••••••
当 authMethod 为 'api_key' 时显示。
用户名
输入用户名
当 authMethod 为 'basic_auth' 时显示。
密码
••••••••
当 authMethod 为 'basic_auth' 时显示。
索引名称*
my-index
文档 ID*
unique-document-id
刷新
默认
删除文档 (
elasticsearch_delete_document)按 ID 删除 Elasticsearch 中的文档。
输入
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
deploymentType | string | 是 | 部署类型:self_hosted 或 cloud |
host | string | 否 | Elasticsearch 主机 URL (用于自托管) |
cloudId | string | 否 | Elastic Cloud ID (用于云端部署) |
authMethod | string | 是 | 认证方式:api_key 或 basic_auth |
apiKey | string | 否 | Elasticsearch API 密钥 |
username | string | 否 | 基本认证的用户名 |
password | string | 否 | 基本认证的密码 |
index | string | 是 | 索引名称 |
documentId | string | 是 | 要删除的文档 ID |
refresh | string | 否 | 刷新策略:true、false 或 wait_for |
输出
| 参数 | 类型 | 说明 |
|---|---|---|
_index | string | 索引名称 |
_id | string | 文档 ID |
_version | number | 文档版本 |
result | string | 操作结果 (deleted 或 not_found) |
批量操作
操作
批量操作
部署类型
自托管
Elasticsearch 主机
https://localhost:9200
当 deploymentType 为 'self_hosted' 时显示。
Cloud ID
deployment-name:base64-encoded-data
当 deploymentType 为 'cloud' 时显示。
认证方式
API 密钥
API 密钥
••••••••
当 authMethod 为 'api_key' 时显示。
用户名
输入用户名
当 authMethod 为 'basic_auth' 时显示。
密码
••••••••
当 authMethod 为 'basic_auth' 时显示。
索引名称*
my-index
批量操作*
json
{ "index": { "_index": "my-index", "_id": "1" } }
{ "field": "value" }
{ "delete": { "_index": "my-index", "_id": "2" } }
刷新
默认
批量操作 (
elasticsearch_bulk)在单个请求中执行多个索引、创建、删除或更新操作,以实现高性能。
输入
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
deploymentType | string | 是 | 部署类型:self_hosted 或 cloud |
host | string | 否 | Elasticsearch 主机 URL (用于自托管) |
cloudId | string | 否 | Elastic Cloud ID (用于云部署) |
authMethod | string | 是 | 认证方式:api_key 或 basic_auth |
apiKey | string | 否 | Elasticsearch API 密钥 |
username | string | 否 | 基本认证用户名 |
password | string | 否 | 基本认证密码 |
index | string | 否 | 未指定索引的操作的默认索引 |
operations | string | 是 | 批量操作,格式为 NDJSON 字符串 (换行分隔的 JSON) |
refresh | string | 否 | 刷新策略:true、false 或 wait_for |
输出
| 参数 | 类型 | 描述 |
|---|---|---|
took | number | 批量操作所花费的时间(毫秒) |
errors | boolean | 是否有任何操作出错 |
items | array | 每个操作的结果 |
统计文档数量
操作
统计文档数量
部署类型
自托管
Elasticsearch 主机
https://localhost:9200
当 deploymentType 为 'self_hosted' 时显示。
Cloud ID
deployment-name:base64-encoded-data
当 deploymentType 为 'cloud' 时显示。
认证方式
API 密钥
API 密钥
••••••••
当 authMethod 为 'api_key' 时显示。
用户名
输入用户名
当 authMethod 为 'basic_auth' 时显示。
密码
••••••••
当 authMethod 为 'basic_auth' 时显示。
索引名称*
my-index
查询
json
{ "match": { "field": "value" } }
统计文档数量 (
elasticsearch_count)统计 Elasticsearch 中匹配查询的文档数量。
输入
| 参数 | 类型 | 必需 | 描述 |
|---|---|---|---|
deploymentType | string | 是 | 部署类型:self_hosted 或 cloud |
host | string | 否 | Elasticsearch 主机 URL (用于自托管) |
cloudId | string | 否 | Elastic Cloud ID (用于云部署) |
authMethod | string | 是 | 认证方式:api_key 或 basic_auth |
apiKey | string | 否 | Elasticsearch API 密钥 |
username | string | 否 | 基本认证的用户名 |
password | string | 否 | 基本认证的密码 |
index | string | 是 | 要统计文档数量的索引名称 |
query | string | 否 | 用于过滤文档的可选查询 (JSON 字符串) |
输出
| 参数 | 类型 | 描述 |
|---|---|---|
count | number | 匹配查询的文档数量 |
_shards | object | 分片统计信息 |
创建索引
操作
创建索引
部署类型
自托管
Elasticsearch 主机
https://localhost:9200
当 deploymentType 为 'self_hosted' 时显示。
Cloud ID
deployment-name:base64-encoded-data
当 deploymentType 为 'cloud' 时显示。
认证方式
API 密钥
API 密钥
••••••••
当 authMethod 为 'api_key' 时显示。
用户名
输入用户名
当 authMethod 为 'basic_auth' 时显示。
密码
••••••••
当 authMethod 为 'basic_auth' 时显示。
索引名称*
my-index
索引设置
json
{ "number_of_shards": 1, "number_of_replicas": 1 }
索引映射
json
{ "properties": { "field": { "type": "text" } } }
创建索引(
elasticsearch_create_index)创建新索引,可选配置设置和映射。
输入
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
deploymentType | 字符串 | 是 | 部署类型:self_hosted 或 cloud |
host | 字符串 | 否 | Elasticsearch 主机 URL(用于自托管) |
cloudId | 字符串 | 否 | Elastic Cloud ID(用于云端部署) |
authMethod | 字符串 | 是 | 认证方式:api_key 或 basic_auth |
apiKey | 字符串 | 否 | Elasticsearch API 密钥 |
username | 字符串 | 否 | 用于基本认证的用户名 |
password | 字符串 | 否 | 用于基本认证的密码 |
index | 字符串 | 是 | 要创建的索引名称 |
settings | 字符串 | 否 | 索引设置(JSON 字符串) |
mappings | 字符串 | 否 | 索引映射(JSON 字符串) |
输出
| 参数 | 类型 | 描述 |
|---|---|---|
acknowledged | 布尔值 | 请求是否已被确认 |
shards_acknowledged | 布尔值 | 分片是否已被确认 |
index | 字符串 | 已创建的索引名称 |
删除索引
操作
删除索引
部署类型
自托管
Elasticsearch 主机
https://localhost:9200
当 deploymentType 为 'self_hosted' 时显示。
Cloud ID
deployment-name:base64-encoded-data
当 deploymentType 为 'cloud' 时显示。
认证方式
API 密钥
API 密钥
••••••••
当 authMethod 为 'api_key' 时显示。
用户名
输入用户名
当 authMethod 为 'basic_auth' 时显示。
密码
••••••••
当 authMethod 为 'basic_auth' 时显示。
索引名称*
my-index
删除索引(
elasticsearch_delete_index)删除索引及其所有文档。此操作不可逆。
输入
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
deploymentType | string | 是 | 部署类型:self_hosted 或 cloud |
host | string | 否 | Elasticsearch 主机 URL (用于自托管) |
cloudId | string | 否 | Elastic Cloud ID (用于云部署) |
authMethod | string | 是 | 认证方式:api_key 或 basic_auth |
apiKey | string | 否 | Elasticsearch API 密钥 |
username | string | 否 | 基本认证的用户名 |
password | string | 否 | 基本认证的密码 |
index | string | 是 | 要删除的索引名称 |
输出
| 参数 | 类型 | 描述 |
|---|---|---|
acknowledged | boolean | 删除是否已确认 |
获取索引信息
操作
获取索引信息
部署类型
自托管
Elasticsearch 主机
https://localhost:9200
当 deploymentType 为 'self_hosted' 时显示。
Cloud ID
deployment-name:base64-encoded-data
当 deploymentType 为 'cloud' 时显示。
认证方式
API 密钥
API 密钥
••••••••
当 authMethod 为 'api_key' 时显示。
用户名
输入用户名
当 authMethod 为 'basic_auth' 时显示。
密码
••••••••
当 authMethod 为 'basic_auth' 时显示。
索引名称*
my-index
获取索引信息 (
elasticsearch_get_index)检索索引信息,包括设置、映射和别名。
输入
| 参数 | 类型 | 是否必需 | 描述 |
|---|---|---|---|
deploymentType | 字符串 | 是 | 部署类型:self_hosted 或 cloud |
host | 字符串 | 否 | Elasticsearch 主机 URL (用于自托管) |
cloudId | 字符串 | 否 | Elastic Cloud ID (用于云部署) |
authMethod | 字符串 | 是 | 认证方式:api_key 或 basic_auth |
apiKey | 字符串 | 否 | Elasticsearch API 密钥 |
username | 字符串 | 否 | 基本认证的用户名 |
password | 字符串 | 否 | 基本认证的密码 |
index | 字符串 | 是 | 要检索信息的索引名称 |
输出
| 参数 | 类型 | 描述 |
|---|---|---|
index | JSON | 索引信息,包括别名、映射和设置 |
集群健康
操作
集群健康
部署类型
自托管
Elasticsearch 主机
https://localhost:9200
当 deploymentType 为 'self_hosted' 时显示。
云 ID
deployment-name:base64-encoded-data
当 deploymentType 为 'cloud' 时显示。
认证方式
API 密钥
API 密钥
••••••••
当 authMethod 为 'api_key' 时显示。
用户名
输入用户名
当 authMethod 为 'basic_auth' 时显示。
密码
••••••••
当 authMethod 为 'basic_auth' 时显示。
等待状态
无
超时(秒)
30
集群健康(
elasticsearch_cluster_health)获取 Elasticsearch 集群的健康状态。
输入
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
deploymentType | string | 是 | 部署类型:self_hosted 或 cloud |
host | string | 否 | Elasticsearch 主机 URL (自托管) |
cloudId | string | 否 | Elastic Cloud ID (云端部署) |
authMethod | string | 是 | 认证方式:api_key 或 basic_auth |
apiKey | string | 否 | Elasticsearch API 密钥 |
username | string | 否 | 基本认证用户名 |
password | string | 否 | 基本认证密码 |
waitForStatus | string | 否 | 等待集群达到此状态:green、yellow 或 red |
timeout | string | 否 | 等待操作的超时时间 (例如 30s、1m) |
输出
| 参数 | 类型 | 说明 |
|---|---|---|
cluster_name | string | 集群名称 |
status | string | 集群健康状态:green、yellow 或 red |
number_of_nodes | number | 集群节点总数 |
number_of_data_nodes | number | 数据节点数量 |
active_shards | number | 活跃分片数量 |
unassigned_shards | number | 未分配分片数量 |
集群统计
操作
集群统计
部署类型
自托管
Elasticsearch 主机
https://localhost:9200
当 deploymentType 为 'self_hosted' 时显示。
Cloud ID
deployment-name:base64-encoded-data
当 deploymentType 为 'cloud' 时显示。
认证方式
API 密钥
API 密钥
••••••••
当 authMethod 为 'api_key' 时显示。
用户名
输入用户名
当 authMethod 为 'basic_auth' 时显示。
密码
••••••••
当 authMethod 为 'basic_auth' 时显示。
集群统计 (
elasticsearch_cluster_stats)获取 Elasticsearch 集群的全面统计信息。
输入
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
deploymentType | string | 是 | 部署类型:self_hosted 或 cloud |
host | string | 否 | Elasticsearch 主机 URL (用于自托管) |
cloudId | string | 否 | Elastic Cloud ID (用于云部署) |
authMethod | string | 是 | 认证方法:api_key 或 basic_auth |
apiKey | string | 否 | Elasticsearch API 密钥 |
username | string | 否 | 基本认证的用户名 |
password | string | 否 | 基本认证的密码 |
输出
| 参数 | 类型 | 描述 |
|---|---|---|
cluster_name | string | 集群名称 |
status | string | 集群健康状态 |
nodes | object | 节点统计信息,包括数量和版本 |
indices | object | 索引统计信息,包括文档数量和存储大小 |
使用说明
将 Elasticsearch 集成到工作流中,以实现强大的搜索、索引和数据管理。支持文档 CRUD 操作、高级搜索查询、批量操作、索引管理和集群监控。适用于自托管和 Elastic Cloud 部署。
注意事项
- 类别:
tools - 类型:
elasticsearch