Querying the Index Configurations of a Specified Log Stream
Function
This API is used to query the index configurations of a specified log stream.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.
URI
GET /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: 32 Maximum: 32 |
|
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 |
Definition User token obtained from IAM. For details about how to obtain it, see Obtaining a User Token. Constraints N/A Range N/A Default Value N/A |
|
Content-Type |
Yes |
String |
Definition Message body format. Set this parameter to application/json;charset=utf8. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
fullTextIndex |
LTSFullTextIndexInfo object |
Full-text indexing configuration. |
|
fields |
Array of LTSFieldsInfo objects |
Field indexing configuration. |
|
logStreamId |
String |
Log stream ID. |
|
Parameter |
Type |
Description |
|---|---|---|
|
enable |
Boolean |
Definition Whether to enable full-text indexing. Constraints N/A Range true: Full-text indexing is enabled. false: Full-text indexing is disabled. Default Value true |
|
caseSensitive |
Boolean |
Definition Whether letters are case-sensitive when full-text indexing is enabled. Constraints N/A Range true: Letters are case-sensitive. false: Letters are case insensitive. Default Value false |
|
includeChinese |
Boolean |
Definition Whether full-text indexing includes Chinese characters. Constraints N/A Range true: Chinese characters are included. false: Chinese characters are not included. Default Value false |
|
tokenizer |
String |
Definition Delimiters. The log content can be split into multiple words based on the specified delimiters. If the default delimiters do not meet your requirements, use custom delimiters. Constraints N/A Range Minimum characters: 0 Maximum characters: 128 Default Value , '";=()[]{}@&<>/:\n\t\r |
|
ascii |
Array of strings |
Definition ASCII delimiters. Enter ASCII values and characters by referring to ASCII Table. Constraints N/A Range Minimum characters: 1 Maximum characters: 3 Default Value N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
fieldType |
String |
Definition Log field type for field indexing. Constraints N/A Range
Default Value string |
|
fieldName |
String |
Definition Log field name for field indexing. Constraints
Range Field in the sample log. Default Value N/A |
|
caseSensitive |
Boolean |
Definition Whether to enable case sensitivity for field indexing. Constraints N/A Range
Default Value false |
|
includeChinese |
Boolean |
Definition Whether field indexing includes Chinese characters. Constraints N/A Range
Default Value false |
|
tokenizer |
String |
Definition Custom delimiters. Constraints N/A Range N/A Default Value , '";=()[]{}@&<>/:\?\n\t\r |
|
quickAnalysis |
Boolean |
Definition Whether to enable quick analysis for field indexing. Constraints
Range Default Value true |
|
ascii |
Array of strings |
Definition ASCII delimiters. Constraints N/A |
|
ltsSubFieldsInfoList |
Array of LTSSubFieldsInfo objects |
Definition Field information when the field type in the field index configuration is JSON. Constraints N/A |
|
fieldAnalysisAlias |
String |
Definition Alias. After an alias is set, you can only use that alias for SQL search and analysis. However, it cannot be used for keyword search. Constraints N/A Range Maximum 256 characters. Default Value N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
fieldType |
String |
Definition Log field type for field indexing. Constraints N/A Range
Default Value string |
|
fieldName |
String |
Definition Log field name for field indexing. Constraints
Range Field in the sample log. Default Value N/A |
|
quickAnalysis |
Boolean |
Definition Whether to enable quick analysis for field indexing. Constraints
Range true: enables quick analysis. false: disables quick analysis. Default Value true |
|
fieldAnalysisAlias |
String |
Definition Alias. After an alias is set, you can only use that alias for SQL search and analysis. However, it cannot be used for keyword search. Constraints N/A Range Maximum 256 characters. Default Value N/A |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition Error code. For details, see Error Codes. Range N/A |
|
error_msg |
String |
Definition Error message. Range N/A |
Status code: 500
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition Error code. For details, see Error Codes. Range N/A |
|
error_msg |
String |
Definition Error message. Range N/A |
Example Requests
Query the index configurations of a specified log stream of the current tenant. The request parameter is same as the path parameter. No request example is provided.
Example Responses
Status code: 200
The request is successful and the index configuration is queried.
{
"logStreamId" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"fullTextIndex" : {
"ascii" : [ ],
"tokenizer" : ", '\";=()[]{}@&<>/:\\n\\t\\r",
"enable" : true,
"caseSensitive" : true,
"includeChinese" : false
},
"fields" : [ {
"ascii" : [ ],
"tokenizer" : ", '\";=()[]{}@&<>/:\\\\?\\n\\t\\r",
"fieldName" : "field1",
"caseSensitive" : false,
"includeChinese" : true,
"quickAnalysis" : true,
"fieldType" : "string",
"ltsSubFieldsInfoList" : null
}, {
"ascii" : [ ],
"tokenizer" : ", '\";=()[]{}@&<>/:\\\\?\\n\\t\\r",
"fieldName" : "field2",
"caseSensitive" : false,
"includeChinese" : true,
"quickAnalysis" : true,
"fieldType" : "string",
"ltsSubFieldsInfoList" : null
} ]
}
Status code: 400
BadRequest: The request is invalid. Modify the request based on the description in error_msg before a retry.
{
"errorCode" : "SVCSTG.ALS.200201",
"errorMessage" : "Query Param is error."
}
Status code: 500
InternalServerError: The server has received the request but encountered an internal error.
{
"error_code" : "LTS.0102",
"error_msg" : "Query empty."
}
SDK Sample Code
The SDK sample code is as follows.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.lts.v2.region.LtsRegion; import com.huaweicloud.sdk.lts.v2.*; import com.huaweicloud.sdk.lts.v2.model.*; public class ListLogStreamIndexSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); LtsClient client = LtsClient.newBuilder() .withCredential(auth) .withRegion(LtsRegion.valueOf("<YOUR REGION>")) .build(); ListLogStreamIndexRequest request = new ListLogStreamIndexRequest(); request.withGroupId("{group_id}"); request.withStreamId("{stream_id}"); try { ListLogStreamIndexResponse response = client.listLogStreamIndex(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdklts.v2.region.lts_region import LtsRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdklts.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = LtsClient.new_builder() \ .with_credentials(credentials) \ .with_region(LtsRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListLogStreamIndexRequest() request.group_id = "{group_id}" request.stream_id = "{stream_id}" response = client.list_log_stream_index(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" lts "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := lts.NewLtsClient( lts.LtsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListLogStreamIndexRequest{} request.GroupId = "{group_id}" request.StreamId = "{stream_id}" response, err := client.ListLogStreamIndex(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
The request is successful and the index configuration is queried. |
|
400 |
BadRequest: The request is invalid. Modify the request based on the description in error_msg before a retry. |
|
500 |
InternalServerError: The server has received the request but encountered an internal error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot