获取索引信息¶
GET /api/v1/log_index_cfg/{cfg_uuid}/get
概述¶
获取当前工作空间某个日志索引的配置,可选择返回字段映射。
调用前和使用步骤¶
从日志索引列表取当前工作空间索引 UUID,默认索引用 default。绑定存储的连接配置仅在需要时读取。accessCfg 可能包含访问凭据或可逆编码内容,应按凭据保护。示例节选常用字段。 调用凭据需要 log.indexManage 或 log.externalIndexManage 权限。
路由参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| cfg_uuid | string | Y | 目标日志索引配置 UUID,也可填 default。 例子: default获取或填写方式: 从日志索引列表的 content[].uuid 或分页 content.data[].uuid 获取,仅使用当前空间中的索引。 |
请求头¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| DF-API-KEY | string | Y | 工作空间调用凭据。记录 UUID 与调用凭据是不同字段。 例子: <DF-API-KEY>获取或填写方式: 从当前工作空间 API Key 管理取得完整凭据。 |
Query 请求参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| isShowAccessCfg | boolean | 是否返回 accessCfg,默认 false。 例子: false获取或填写方式: 只有确实需要连接配置时才传 true。 |
|
| isShowFields | boolean | 是否返回字段映射,默认 false。 例子: true获取或填写方式: 需要了解可查询字段的映射时传 true。 |
参数补充说明¶
示例中的资源标识为占位值,请替换为目标工作空间的实际值。
请求例子¶
curl --get -H "DF-API-KEY: <DF-API-KEY>" \
'https://openapi.guance.com/api/v1/log_index_cfg/default/get' \
--data-urlencode "isShowFields=true"
响应¶
HTTP 200,application/json。
| 字段 | 类型 | 说明 |
|---|---|---|
| content.uuid | string | 索引配置标识。普通行用于获取索引详情,默认索引使用 default。 |
| content.name | string | 日志索引名称。 |
| content.workspaceUUID | string | 索引所属工作空间。 |
| content.duration | string | 日志保留时长,例如 14d;绑定外部存储的索引可为空。 |
| content.isBindCustomStore | integer 或 boolean | 绑定外部存储为 1,普通托管索引为 0;默认行可返回 false。 |
| content.queryType | string | 索引可支持的查询类型。 |
| content.directIndex | integer | 普通索引的原生直写标记,1 表示是,0 表示否。默认索引可省略。 |
| content.sortNo | string 或 integer | 索引配置中用于排序的值;默认索引可为 -1。 |
| content.storeType | string | 索引关联的存储类型,默认索引可省略。 |
| content.accessCfg | object | 仅 isShowAccessCfg=true 时返回;可能包含存储访问凭据。 |
| content.fields | array<object> |
仅 isShowFields=true 时返回的映射列表,默认索引可无字段。 |
| content.fields[].field | string | 查询使用的字段名称。 |
| content.fields[].originalField | string | 来源存储中的字段名称。 |
| content.cloneConfig | object 或 null | 克隆索引的配置,普通索引可为空。 |
| content.sourceIndexName | string | 克隆索引关联的源索引名称。 |
| content.regionInfo | object | 存储区域或授权信息;默认索引为 {}。 |
| content.declaration | object 或 null | 工作空间声明。 |
{
"code": 200,
"content": {
"uuid": "default",
"name": "default",
"workspaceUUID": "wksp_example",
"duration": "14d",
"isBindCustomStore": false,
"queryType": "logging",
"sortNo": -1,
"declaration": null,
"regionInfo": {},
"fields": []
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
错误响应¶
鉴权、限流和公共请求错误参见公共错误定义。
| HTTP 状态 | errorCode | 触发条件 | 消息或响应说明 | 处理方式 |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | 传入未声明的参数或参数值未通过校验 | 参数校验失败,消息指出无效字段。 | 核对各字段的位置和可选值。 |
| 404 | ft.LogIndexCfgNoExists | 配置不属于本空间、已删除、不存在,或克隆索引的源已不可用 | 指定的日志索引配置不存在。 | 重新用同一空间的列表取索引标识,并检查克隆源是否仍存在。 |