Modify Index Key Fields¶
POST /api/v1/workspace/index_key_field/modify
Overview¶
Update all key fields of selected log indexes and synchronize field acceleration according to the global switch.
Prerequisites and Usage Steps¶
The workspace is determined by the API Key. Use a key that has Log Index/Explorer management permissions. Key field configuration controls log display and optional acceleration and does not modify actual log field names, historical log values, or unit descriptions. Index UUIDs and index names cannot be used interchangeably.
Read and back up the configuration first, then submit the complete extendFields for each index after determining syncKeywordSpeed; for duplicate uuids, the last item takes effect; default is processed first; for other UUIDs, valid records are first queried in the current workspace. Concurrent relationship lock exceptions for non-default indexes may return 429; re-read the configuration before retrying. Only the key fields of the selected indexes are overwritten, while other configurations of those indexes are retained; do not use this endpoint to modify field types, full-text indexes, or index retention periods.
syncKeywordSpeed defaults to true: when changed from disabled to enabled, it synchronizes key fields for all indexes; when already enabled, it creates acceleration only for fields newly appearing in this batch. false saves the global disabled state, but does not proactively delete existing accelerated fields; clearing extendFields also does not proactively delete acceleration. Because of the default value, even if cfgList is omitted, global synchronization may be triggered; callers must decide explicitly.
Configuration is submitted first, and acceleration is then dispatched. Fewer than 200 deduplicated (index, field) operations are processed synchronously; larger batches are delivered in the background in shards of 200, and delivery failures can fall back to synchronous processing. Individual downstream acceleration failures are recorded but do not necessarily cause this endpoint to fail. HTTP 200/true only indicates that configuration processing and the dispatch path are complete, and does not guarantee that all acceleration has completed; this response has no task ID or per-field success list. Read back the key fields after writing; actual acceleration must be verified separately; do not assume configuration rollback on failure.
Request Headers¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to obtain or enter: Obtain an OpenAPI Key with the required permissions from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| cfgList | array | Optional array. Omitting it or passing [] does not change specific index fields, but global syncKeywordSpeed with its default true is still processed; do not treat an empty batch as strictly no-op. Allows null: False Example: [{"uuid": "default", "extendFields": [{"tag": "host", "alias": "主机"}, {"tag": "service", "alias": "服务"}]}]How to obtain or enter: First read cfg_uuid from Read Key Fields, and fully backfill the fields still needed. |
|
| cfgList[*] | object | Each item must be submitted according to the structure on this page; if uuid/extendFields is missing or a sub-item does not conform to the public declaration, a 406 is returned first. For duplicate uuids, later items overwrite earlier items. Example: {"uuid": "default", "extendFields": [{"tag": "host", "alias": "主机"}, {"tag": "service", "alias": "服务"}]}How to obtain or enter: Each object corresponds to one index configuration. |
|
| cfgList[*].uuid | string | Conditionally required | Index configuration UUID. A regular index name cannot be used instead. For non-default values, valid records in the current workspace are queried first and a relationship lock is acquired; unknown/deleted/out-of-workspace UUIDs may return 404; they are not always ignored. Allows null: False Example: defaultHow to obtain or enter: Take cfg_uuid from Read Key Fields; or take uuid from Log Index List. The default item is always default. |
| cfgList[*].extendFields | array | Conditionally required | Complete key field list for this index, which overwrites the original value; [] is used to clear it; although an empty string is compatible with the historical declaration, the business layer still returns 400, so it is not used for clearing. List order is preserved; removing a field does not automatically delete its existing acceleration index. Allows null: False Allows empty string: True Example: [{"tag": "host", "alias": "主机"}, {"tag": "service", "alias": "服务"}]How to obtain or enter: Copy the complete list from the read result, then add or remove fields. |
| cfgList[*].extendFields[*] | object | Only tag and alias are allowed, and tag must be non-empty; the public declaration usually first rejects non-objects, extra subkeys, and field type errors with 406. Example: {"tag": "host", "alias": "主机"}How to obtain or enter: Enter the actual field name and optional display alias for each item. |
|
| cfgList[*].extendFields[*].tag | string | Conditionally required | Required actual field name; clients use a non-empty string; do not enter an alias. Allows null: False Example: hostHow to obtain or enter: Use the actual log field name; you can query it using SHOW_LOGGING_FIELD(index=...). |
| cfgList[*].extendFields[*].alias | string | Optional alias, not used to match actual fields. Allows null: False Allows empty string: True Example: 主机How to obtain or enter: Fill in as needed for display; omit it or use an empty string if not needed. |
|
| syncKeywordSpeed | boolean | Optional boolean. If omitted, defaults to true and may re-enable global synchronization. false disables global automatic synchronization rather than only skipping this request; it does not delete existing acceleration indexes. Allows null: False Example: falseHow to obtain or enter: The workspace administrator determines the global keyword automatic acceleration policy; this read endpoint does not return this switch. |
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/workspace/index_key_field/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"cfgList":[{"uuid":"default","extendFields":[{"tag":"host","alias":"主机"},{"tag":"service","alias":"服务"}]}],"syncKeywordSpeed":false}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content | boolean | Returns true on success; this is not a per-index/per-accelerated-field completion status. |
{
"code": 200,
"content": true,
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
Ordinary Kodo acceleration failures during key field synchronization are usually swallowed and logged, so not all downstream count/index errors are listed as errors that this endpoint necessarily passes through; pre-checks/shard checks such as lock ownership can still cause the request to fail.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Resolution |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | Request fields are missing, or field values violate the declared validation conditions | Parameter parsing failed | Check parameter locations, field names, types, and values. |
| 400 | ft.RequestJsonFormatError | Invalid request JSON syntax | Request JSON format error | Correct the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | The top level of the request JSON is not an object | Some JSON file format errors | Submit a configuration JSON object. |
| 400 | ft.InvalidLogIndexCfgKeyFields | After passing public validation, the structure still does not conform to key field requirements, for example, an empty string in extendFields passes historical compatibility validation and then enters business array validation | Invalid log index key fields | Fill in according to the structure and retain actual field names. |
| 404 | ft.LogIndexCfgNoExists | When locating a non-default index before locking, no valid configuration is found in the current workspace | The specified log index configuration does not exist | Re-read the index UUID and exclude deleted records or records from other workspaces. |
| 429 | ft.OperationTooFrequently | The index relationship lock is unavailable, failed to be acquired, or the lock lease is lost during execution | Your operation is too frequent. Please try again later. | Read back the submitted configuration before retrying later to avoid concurrent duplicate batches. |
| 500 | ft.InternalServerError | An uncontrolled exception occurs during configuration reading, storage, caching, or downstream processing | Internal error | Retain traceId; for write requests, first read/verify completed items, then decide whether to retry. |