You need to enable JavaScript to run this app.
Torch Log Service

Torch Log Service

Copy page
Download PDF
Index management API
ModifyIndex
Copy page
Download PDF
ModifyIndex
Call the ModifyIndex API to update index settings.​
Instructions for use​
This API modifies the index configuration for a log topic. There is a limit of 20 calls per second. If exceeded, an ExceedQPSLimit error will occur.​
tip​
  • At least one index must be enabled: full-text index or key-value index. If all indexes are disabled, collected log data cannot be queried.​
  • TLS words have a character limit of 32,766 characters. If you do not set delimiters, logs whose full-text or word fields are too long might be discarded.​
  • You can modify the index at any time after configuration. When updating the index, pay attention to the following:​
  • The new index only applies to new data collected after the change. The index for existing data will not update.​
  • Query and analysis can only be performed based on one index rule at a time. Therefore, modifying the index configuration may cause the same previous query analysis statements to yield different results, as the new index settings change the scope of data covered by the query analysis.​
Request instructions​
  • Request method: PUT​
  • Request URL: https://{tls-endpoint}/ModifyIndex​
Request parameters​
The table below lists only the unique request parameters for this API and some common parameters. For more details, see Common Parameters.​
Body​
​
Parameters​
Type​
Required​
Example value​
Description​
TopicId​
String​
Yes​
4a*********​
Log topic ID.​
FullText​
Object of FullTextInfo​
No​
/​
Full-text index configuration.​
  • If this field is null or not configured, the full-text index is disabled.​
  • At least one full-text index or key-value index configuration is required; at least one parameter between FullText and KeyValue must be specified.​
KeyValue​
Array of KeyValueInfo​
No​
/​
Key-value index configuration​
  • If the length of this field array is 0 or not configured, key-value index is not enabled​
  • Configure at least one of full-text index or key-value index. That is, you must specify at least one of FullText or KeyValue​
UserInnerKeyValue​
Array of KeyValueInfo​
No​
/​
Reserved field index configuration.​
  • If the length of this field array is 0 or not configured, reserved field index is not enabled​
  • You cannot enable both full-text index and key-value index for the reserved field __content__ at the same time. If you set the __content__ index through the UserInnerKeyValue parameter, you cannot set the FullText parameter simultaneously​
  • Currently, only __content__ in reserved fields supports manual index enabling For other reserved field index settings, refer to Reserved fields​
MaxTextLen​
Integer​
No​
2048​
Statistical field value maximum length defaults to 2048 bytes, and can be set between 64 and 1048576 bytes.​
tip​
  • If a single field value exceeds the maximum length you set, the excess part will be truncated and not included in analysis​
  • After the field's maximum length is updated, the change only applies to incremental data​
EnableAutoIndex​
Boolean​
No​
true​
Enable automatic index updates. When enabled, the system will automatically add new fields to the key-value index.​
  • true: Enable auto-update.​
  • false: Do not enable automatic updates.​
​
FullTextInfo​
​
Parameters​
Type​
Required​
Example value​
Description​
Delimiter​
String​
Yes​
, ;/\n\t​
Delimiter for full-text index.​
  • Each character in the string represents a delimiter.​
  • Length must be between 1 and 256 bytes.​
  • Supports one or more of the following characters:​
  • Letters (case-sensitive), numbers, and !@#%^&*()-_=\\"", <>/?|;:\n\t\r[]{}.​
  • Supports configuring both Chinese characters and delimiters.​
CaseSensitive​
Boolean​
Yes​
false​
Case sensitive.​
  • true: Case sensitive.​
  • false: Not case sensitive.​
IncludeChinese​
Boolean​
No​
false​
When querying, choose whether to split the Chinese content in logs according to Chinese grammar. The default is false​
  • true:​
  • Chinese characters in logs: Logs are split based on common Chinese grammar rules. Delimiter that contains custom Chinese content is not supported.​
  • Non-Chinese characters in logs: Split logs based on the delimiter specified in the delimiter parameter.​
  • false: Logs are split based on the delimiter specified in the delimiter parameter.​
​
KeyValueInfo​
​
Parameters​
Type​
Required​
Example value​
Description​
Key​
String​
Yes​
"Key": "test-key1"​
Specify the field name for key-value index configuration. Up to 100 fields can be added.​
  • Support only letters, numbers, spaces, underscores (_), hyphens (-), and slashes (/). Do not support starting or ending with space.​
  • Within the same index, the key name must be unique.​
  • Length must be between 1 and 128 characters.​
tip​
For subfields of key-value index with JSON type, use a dot (.) to indicate the hierarchy between JSON fields. For example, if the JSON field "namelist" includes a text-type subfield "totalcount" and a JSON-type subfield "info," and "info" contains a field "name," configure the field names as "totalcount" and "info.name" respectively.​
Value​
Object of Value​
Yes​
"Value": { "ValueType": "text", "Delimiter": "", "CaseSensitive": true, "IncludeChinese": false, "SqlFlag": false }​
Provide a description for the field to configure key-value index.​
​
Value​
​
Parameters​
Type​
Required​
Example value​
Description​
SqlFlag​
Boolean​
No​
false​
Whether to enable analysis for this field. The default value is false. After enabling statistical analysis, you can configure delimiters and support contains Chinese.​
IndexAll​
Boolean​
No​
false​
Create indexes for all fields with textual values in the JSON fields.​
JsonKeys​
Array of KeyValueInfo​
No​
[ { "Key":"key1", "Value":{ "ValueType":"text", "SqlFlag":true } }, { "Key":"key2", "Value":{ "ValueType":"long", "SqlFlag":true } }, { "Key":"key3.key4.key5", "Value":{ "ValueType":"double", "SqlFlag":true } } ]​
When ValueType is set to JSON, you can use the JsonKeys field to configure key-value indexing for JSON subfields, with its value as an array of KeyValueInfo​
  • Each element in the JsonKeys list is a KeyValueInfo and can further define nested subfields of type text, long, or double​
  • For key-value indexing of JSON subfields, use . to indicate the hierarchy between JSON fields. For example, if the JSON field namelist contains a text-type subfield called totalcount and a JSON-type subfield called info, and info in turn contains the field name, each field should be configured as totalcount and info.name respectively​
  • The SqlFlag settings for key-value indexes of subfields defined in JsonKeys should match those of their parent fields. They must be enabled or disabled together and are disabled by default. Subfields do not support separate settings for Delimiter, Case sensitive, and Contains Chinese. For fields of type text, Case sensitive, Delimiter, and Contains Chinese always follow the parent field settings.​
  • Set this only when ValueType is json.​
Delimiter​
String​
No​
, ;/\n\t​
Delimiter for the field. Default is empty ("").​
  • Each character in the string represents a delimiter.​
  • Length must be between 0 and 256 bytes. If the length is 0, delimiter is not applied.​
  • Only supports one or more of the following characters:​
  • Uppercase and lowercase letters, numbers, and !@#%^&*()-_=\\\"', <>/?|;:\n\t\r[]{}.​
  • Supports configuration with both Chinese characters and delimiters.​
ValueType​
String​
Yes​
text​
Field type.​
  • Currently supports long, double, text, and json.​
  • Long and double types do not support delimiter configuration, contain Chinese, or case sensitivity.​
  • Only the JSON type supports further configuration of JsonKeys subfields​
CaseSensitive​
Boolean​
No​
true​
Indicates whether case sensitivity is enabled. The default value is false.​
IncludeChinese​
Boolean​
No​
false​
When querying, TLS can split the Chinese content of logs according to Chinese grammar. You can choose to enable or disable this function.​
  • Enable:​
  • Chinese characters in logs: Logs are split based on common Chinese grammar rules. Delimiter that contains custom Chinese content is not supported.​
  • Non-Chinese characters in logs: Split logs based on the delimiter specified in the delimiter parameter.​
  • Disabled: Split logs based on the delimiter specified in the delimiter parameter.​
Description​
String​
No​
test​
Description information of the indexed fields.​
IndexSQLAll​
Boolean​
No​
false​
Enable automatic indexing and statistics for JSON fields​
  • true: Enable automatic indexing and statistics​
  • false: Do not enable automatic indexing and statistics​
AutoIndexFlag​
Boolean​
No​
false​
Indicates whether this index was automatically added.​
  • true: This index was added automatically.​
  • false: This index was not added automatically.​
​
Return parameters​
This API does not have specific return parameters. For more information, see Return structure.​
Sample request 1​
Full-text index example​
​
PUT https://{tls-endpoint}/ModifyIndex HTTP/1.1​
Content-Type: application/json​
{​
"TopicId": "3***********",​
"FullText": {​
"Delimiter": ",-;",​
"CaseSensitive": false,​
"IncludeChinese": false​
}​
}​
​
Sample return 1​
​
HTTP/1.1 200 OK​
Content-Type: application/json; charset=utf-8​
{}​
​
Sample request 2​
Full-text index and key-value index example​
​
PUT https://{tls-endpoint}/ModifyIndex HTTP/1.1​
Content-Type: application/json​
{​
"TopicId": "4a*********",​
"FullText": {​
"Delimiter": ", ;/\\n\\t",​
"CaseSensitive": false,​
"IncludeChinese": false​
},​
"KeyValue": [​
{​
"Key": "test-key1",​
"Value": {​
"ValueType": "text",​
"Delimiter": "",​
"CaseSensitive": true,​
"IncludeChinese": false,​
"SqlFlag": false,​
"IndexAll": false,​
"JsonKeys": [],​
"Description":test,​
"IndexSQLAll": false,​
"AutoIndexFlag": false​
}​
}​
],​
"UserInnerKeyValue": [​
{​
"Key": "__content__",​
"Value": {​
"ValueType": "text",​
"Delimiter": "",​
"CaseSensitive": true,​
"IncludeChinese": false,​
"SqlFlag": false,​
"IndexAll": false,​
"JsonKeys": [],​
"Description":test,​
"IndexSQLAll": false,​
"AutoIndexFlag": false​
}​
}​
],​
"MaxTextLen": 2048,​
"EnableAutoIndex": true​
}​
​
Sample return 2​
​
HTTP/1.1 200 OK​
Content-Type: application/json; charset=utf-8​
{}​
​
Sample request 3​
Key-value index and reserved field index example​
​
PUT https://{tls-endpoint}/ModifyIndex HTTP/1.1​
Content-Type: application/json​
{​
"TopicId": "4a*********",​
"FullText": {​
"Delimiter": ", ;/\\n\\t",​
"CaseSensitive": false,​
"IncludeChinese": false​
},​
"KeyValue": [​
{​
"Key": "test-key1",​
"Value": {​
"ValueType": "text",​
"Delimiter": "",​
"CaseSensitive": true,​
"IncludeChinese": false,​
"SqlFlag": false,​
"IndexAll": false,​
"JsonKeys": [],​
"Description":test,​
"IndexSQLAll": false,​
"AutoIndexFlag": false​
}​
}​
],​
"UserInnerKeyValue": [],​
"MaxTextLen": 2048,​
"EnableAutoIndex": true​
}​
​
Sample response 3​
​
HTTP/1.1 200 OK​
Content-Type: application/json; charset=utf-8​
{}​
​
Error Code​
The following table lists error codes related to this interface and business logic. For public error codes, see the Public Error Code documentation.​
​
HTTP status code​
Error Code​
Error message​
Description​
400​
InvalidArgument​
Invalid argument key %s, value %s, please check argument.​
Invalid parameter.​
400​
InvalidArgument​
At least one of full-text indexing and key-value indexing must be turned on.​
You need to enable at least one of full-text index or key-value index​
400​
InvalidArgument​
Index key value_type:%s conflict with [includeChinese:%t, casSensitive:%t, delimiter:%s], please check argument.​
Long/double types do not support Contains Chinese, Case sensitive, or Delimiter configuration.​
400​
InvalidIndexJsonKeys​
Non-JSON field %s configures JsonKeys, please check argument.​
Not a JSON field configuration sub-field.​
400​
ConflictIndexJsonKeys​
JsonKeys %s and %s have conflict prefix, please check argument.​
JsonKeys key name has a prefix conflict.​
400​
InvalidArgument​
Index key sqlFlag:%t conflict with [includeChinese:%t, delimiter:%s], please check argument.​
After enabling statistics, you cannot configure Contains Chinese or Delimiter settings.​
400​
IndexKeyValueQuotaExceed​
Exceeded index key-value quota.​
Exceeded key-value index quota.​
400​
IndexKeyDuplicate​
The %dth index key name:%s is duplicate, please check argument.​
Index key name is duplicated.​
400​
InvalidArgument​
Index key delimiter:%s conflict with includeChinese:%t, please check argument.​
Delimiter and Chinese word segmentation cannot be configured at the same time.​
400​
IndexKVNULL​
Index key value index is open, but the key value list is null, please check argument.​
The number of keys configured for the key-value index is 0.​
404​
TopicNotExist​
Topic does not exist.​
Log topic does not exist.​
409​
IndexAlreadyExist​
Index already exist​
The index already exists.​
500​
InternalServerError​
We encountered an unexpected server error, please try again later.​
Internal server error.​
400​
IndexInnerKeyUnSupport​
key-value indexing for inner key: %v, doesn't support​
Cannot set reserved field index for the %v field.​
400​
IndexInnerKeyConflict​
full-text indexing and content indexing can't be set together​
There is a conflict between full-text index and __content__ index configuration.​
​
Last updated: 2026.07.08 15:45:25