--- title: "查询所有摄入管道" date: 2026-02-10 lastmod: 2026-02-10 description: "查询所有摄入管道的配置" tags: ["摄入管道", "查询", "处理器"] summary: "获取集群中所有摄入管道的配置信息。 API 格式 # GET /_ingest/pipeline API 作用 # 该 API 用于检索集群中所有摄入管道: 返回所有可用的管道配置 查看管道描述和处理器列表 支持获取所有管道的概览信息 API 参数 # 查询参数 # 参数 类型 是否必填 默认值 描述 master_timeout Time 否 默认超时 连接主节点的超时时间 请求示例 # 查询所有管道 # GET /_ingest/pipeline 设置主节点超时 # GET /_ingest/pipeline?master_timeout=50s 响应示例 # 成功响应 # { "my-pipeline": { "id": "my-pipeline", "config": { "description": "Process and enrich documents", "processors": [ { "set": { "field": "processed", "value": true } }, { "rename": { "field": "old_field", "target_field": "new_field" } }, { "remove": { "field": "temp_field" } } ] } }, "logs-pipeline": { "id": "logs-pipeline", "config": { "description": "Enrich logs with metadata", "processors": [ { "set": { "field": "@timestamp", "value": "{{_ingest." --- 获取集群中所有摄入管道的配置信息。 ## API 格式 ``` GET /_ingest/pipeline ``` ## API 作用 该 API 用于检索集群中所有摄入管道: - 返回所有可用的管道配置 - 查看管道描述和处理器列表 - 支持获取所有管道的概览信息 ## API 参数 ### 查询参数 | 参数 | 类型 | 是否必填 | 默认值 | 描述 | |------|------|----------|--------|------| | `master_timeout` | Time | 否 | 默认超时 | 连接主节点的超时时间 | ## 请求示例 ### 查询所有管道 ``` GET /_ingest/pipeline ``` ### 设置主节点超时 ``` GET /_ingest/pipeline?master_timeout=50s ``` ## 响应示例 ### 成功响应 ```json { "my-pipeline": { "id": "my-pipeline", "config": { "description": "Process and enrich documents", "processors": [ { "set": { "field": "processed", "value": true } }, { "rename": { "field": "old_field", "target_field": "new_field" } }, { "remove": { "field": "temp_field" } } ] } }, "logs-pipeline": { "id": "logs-pipeline", "config": { "description": "Enrich logs with metadata", "processors": [ { "set": { "field": "@timestamp", "value": "{{_ingest.timestamp}}" } }, { "set": { "field": "log_level", "value": "{{_ingest.log_level}}" } } ] } }, "metrics-pipeline": { "id": "metrics-pipeline", "config": { "description": "Add metrics to documents", "processors": [ { "set": { "field": "metric.count", "value": 1 } } ] } } } ``` ### 无管道响应 ``` 404 Not Found ``` ```json { "error": { "type": "resource_not_found_exception", "reason": "no pipelines found" } } ``` ## 响应字段说明 ### 顶层对象 | 字段 | 类型 | 描述 | |------|------|------| | `{pipeline_id}` | Object | 以管道 ID 为键的管道配置对象 | ### 管道配置字段 | 字段 | 类型 | 描述 | |------|------|------| | `id` | String | 管道 ID | | `config` | Object | 管道配置对象 | | `config.description` | String | 管道描述 | | `config.processors` | Array | 处理器数组 | ### 处理器对象 | 字段 | 类型 | 描述 | |------|------|------| | `{processor_type}` | Object | 处理器定义(键为处理器类型) | ## 常见处理器类型 | 类型 | 描述 | |------|------| | `set` | 设置字段值 | | `rename` | 重命名字段 | | `remove` | 删除字段 | | `drop` | 删除文档 | | `append` | 追加值到数组 | | `gsub` | 正则替换 | | `uppercase/lowercase` | 大小写转换 | | `join/split` | 数组操作 | | `date` | 日期处理 | | `script` | 脚本处理 | | `fail` | 失败处理器 | ## 使用场景 1. **管道概览**:查看所有已配置的管道 2. **环境检查**:验证集群中的管道配置 3. **文档生成**:自动生成管道文档 4. **配置备份**:导出所有管道配置 ## 注意事项 1. **二进制存储**:管道配置以二进制格式存储以提高性能 2. **主节点通信**:从主节点获取所有管道配置 3. **通配符支持**:使用 GET /_ingest/pipeline/{id} 可进行通配符匹配 4. **空结果**:没有管道时返回 404 Not Found ## 相关操作 - **GET /_ingest/pipeline/{id}**:查询指定管道 - **PUT /_ingest/pipeline/{id}**:创建或更新管道 - **DELETE /_ingest/pipeline/{id}**:删除管道 - **POST /_ingest/pipeline/{id}/_simulate**:模拟管道执行 ## 实现文件 - **REST 处理器**:`RestGetPipelineAction.java` - **请求类**:`GetPipelineRequest.java` - **响应类**:`GetPipelineResponse.java` - **管道配置**:`PipelineConfiguration.java` - **摄入服务**:`IngestService.java`