Creating an Index for a Specified Log Stream
Function
This API is used to create an index for a specified log stream.
URI
POST /v1.0/{project_id}/groups/{group_id}/stream/{stream_id}/index/config
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID. For details about how to obtain a project ID, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID. Minimum: 36 Maximum: 36 |
group_id | Yes | String | Log group ID. For details about how to obtain a log group ID, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID. Minimum: 36 Maximum: 36 |
stream_id | Yes | String | Log stream ID. For details about how to obtain a log stream ID, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID. Minimum: 36 Maximum: 36 |
Request Parameters
Parameter | Mandatory | Type | Description |
---|---|---|---|
X-Auth-Token | Yes | String | User token obtained from IAM. For details about how to obtain a user token, see Obtaining a User Token. |
Content-Type | Yes | String | Set this parameter to application/json;charset=UTF-8. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
logStreamId | No | String | Log stream ID. |
fullTextIndex | Yes | LTSFullTextIndexInfo object | Full-text indexing configuration. |
fields | No | Array of LTSFieldsInfo objects | Field indexing configuration. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
enable | Yes | Boolean | Whether to enable full-text indexing. |
caseSensitive | Yes | Boolean | Whether the value of the field is case-sensitive. |
includeChinese | Yes | Boolean | Whether Chinese characters are contained. |
tokenizer | Yes | String | Custom delimiter. Minimum: 0 Maximum: 128 |
ascii | No | Array of strings | Special delimiter. Minimum: 1 Maximum: 3 |
Parameter | Mandatory | Type | Description |
---|---|---|---|
fieldType | Yes | String | Field type. |
fieldName | Yes | String | Field name. Minimum: 1 Maximum: 256 |
caseSensitive | No | Boolean | Whether the value of the field is case-sensitive. |
includeChinese | No | Boolean | Whether Chinese characters are contained. |
tokenizer | Yes | String | Delimiter. Minimum: 0 Maximum: 128 |
quickAnalysis | No | Boolean | Whether to enable quick analysis. |
ascii | No | Array of strings | Special delimiter. |
Response Parameters
Status code: 200
Parameter | Type | Description |
---|---|---|
errorCode | String | Error code. |
errorMessage | String | Error message. |
result | String | Result. |
isQueryComplete | Boolean | Whether the query is complete. |
Status code: 400
Parameter | Type | Description |
---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Status code: 401
Parameter | Type | Description |
---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Status code: 500
Parameter | Type | Description |
---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Example Requests
This API is used to create an index for a specified log stream.
POST https://{endpoint}/v1.0/{project_id}/groups/{group_id}/stream/{stream_id}/index/config{"logStreamId" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","fullTextIndex" : {"enable" : true,"caseSensitive" : false,"includeChinese" : true,"tokenizer" : ", '\";=()[]{}@&<>/:\\n\\t\\r"},"fields" : [ {"fieldType" : "long","fieldName" : "fieldName1"}, {"fieldType" : "string","fieldName" : "fieldName2","caseSensitive" : false,"includeChinese" : true,"tokenizer" : "","quickAnalysis" : true} ]}
Example Responses
Status code: 200
Indexing is added successfully.
{"errorCode" : "SVCSTG.ALS.200200","errorMessage" : "add or update indexConfig successfully","isQueryComplete" : true,"result" : "493d04ce-5130-4b07-88be-c5ae3b50bccb"}
Status code: 400
Incorrect request parameter . Modify the parameter based on the response body.
{"errorCode" : "SVCSTG.ALS.200201","errorMessage" : "IndexConfigInfo check failed.","isQueryComplete" : true}
Status code: 401
Authentication failed. Check whether the authentication information has expired.
{"error_msg" : "Incorrect IAM authentication information: decrypt token fail","error_code" : "APIGW.0301","request_id" : "b16cc9d789f34cd5196d8df065341788"}
Status code: 500
The service backend has received the request, but an internal processing error occurs.
{"error_code" : "LTS.0203","error_msg" : "Internal Server Error"}
Status Codes
Status Code | Description |
---|---|
200 | Indexing is added successfully. |
400 | Incorrect request parameter . Modify the parameter based on the response body. |
401 | Authentication failed. Check whether the authentication information has expired. |
500 | The service backend has received the request, but an internal processing error occurs. |
Error Codes
See Error Codes.
- URI