Import¶
POST /api/v1/log_index_cfg/import
Overview¶
Bulk import log index templates, supports duplicate name checking, skipping, and overwriting.
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| logIndexes | array | Y | List of log index templates Allow empty: False |
| logIndexes[*] | None | ||
| logIndexes[*].name | string | Y | Index name Allow empty: False |
| logIndexes[*].desc | string | Index description Allow empty: False |
|
| logIndexes[*].directIndex | boolean | Whether it is a native direct-write index Allow empty: False |
|
| logIndexes[*].conditions | string | Matching conditions Allow empty: False |
|
| logIndexes[*].duration | string | Storage duration Allow empty: False |
|
| logIndexes[*].extend | json | Extended configuration Allow empty: False |
|
| logIndexes[*].setting | json | Storage settings Allow empty: False |
|
| logIndexes[*].fields | array | Field mapping configuration Allow empty: False |
|
| logIndexes[*].is_disable | boolean | Whether disabled Allow empty: False |
|
| repeatLogIndexNameOp | string | Duplicate log index name handling strategy Allow empty: False Allowed values: ['check', 'skip', 'recover'] |
Parameter Additional Explanation¶
This API is used to import log index templates individually.
Calling Process
- Prepare the
logIndexesarray, each element represents a log index template. - Specify the handling strategy for encountering duplicate index names via
repeatLogIndexNameOp. - If the strategy is
checkand a duplicate name exists, the API will returnrepeat_nameand will not persist the data.
repeatLogIndexNameOp Explanation
| Value | Description |
|---|---|
| check | Only check for duplicates; returns repeat_name if a duplicate name exists |
| skip | Skip existing duplicate-named indices, only import non-existing indices |
| recover | When a duplicate-named index already exists in the target workspace, overwrite its configuration with the imported template |
Special Rules
- Templates with
name=defaultare ignored and not imported. - External index templates are ignored and not imported.
recoveronly overwrites internal indices with the same name; it does not operate ondefault.
Template Fields
| Field | type | Required | Description |
|---|---|---|---|
| name | string | Yes | Index name |
| desc | string | No | Index description |
| directIndex | boolean | No | Whether it is a native direct-write index |
| conditions | string | No | Matching conditions |
| duration | string | No | Storage duration |
| extend | json | No | Extended configuration |
| setting | json | No | Storage settings |
| fields | array | No | Field mapping |
| is_disable | boolean | No | Whether disabled |
Return Explanation
- Returns
successCount,failCountupon successful import. - If some objects fail, the response will additionally include
failedNames. - In
checkmode, if duplicates are found, returnsrepeat_name.
Request Example¶
curl 'https://openapi.truewatch.com/api/v1/log_index_cfg/import' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"repeatLogIndexNameOp":"recover","logIndexes":[{"name":"app-log","desc":"Application log index","directIndex":false,"conditions":"","duration":"7d","extend":{},"setting":{},"fields":[],"is_disable":false}]}'