All Products
Search
Document Center

Simple Log Service:CreateIndex

Last Updated:Sep 15, 2026

Creates an index for a specified Logstore.

Operation description

The Host consists of a Project name and a Simple Log Service endpoint. You must specify the Project in the Host.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

log:CreateIndex

create

*LogStore

acs:log:{#regionId}:{#accountId}:project/{#project}/logstore/{#logstore}

  • log:TLSVersion
None

Request syntax

POST /logstores/{logstore}/index HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

logstore

string

Yes

The name of the Logstore.

ali-logstore-test

Request parameters

Parameter

Type

Required

Description

Example

project

string

Yes

The name of the Project.

ali-project-test

body

object

No

The request body.

keys

object

No

The configuration of field indexes. A field index is a key-value pair in which the key specifies the name of the field and the value specifies the index configuration of the field. You must specify this parameter, the line parameter, or both parameters. For more information, see Example.

object

No

The index configuration of the field.

caseSensitive

boolean

No

Specifies whether to enable case sensitivity. This parameter is required only when type is set to text. Valid values:

  • true

  • false (default)

chn

boolean

No

Specifies whether to include Chinese characters. This parameter is required only when type is set to text. Valid values:

  • true

  • false (default)

type

string

No

The data type of the field value. Valid values: text, json, double, and long.

alias

string

No

The alias of the field.

token

array

No

The delimiters that are used to split text.

string

No

The delimiter.

doc_value

boolean

No

Specifies whether to turn on Enable Analytics for the field.

line

object

No

The configuration of full-text indexes. You must specify this parameter, the keys parameter, or both parameters. For more information, see Example.

chn

boolean

No

Specifies whether to include Chinese characters. Valid values:

  • true

  • false (default)

caseSensitive

boolean

No

Specifies whether to enable case sensitivity. Valid values:

  • true

  • false (default)

token

array

Yes

The delimiters. You can specify a delimiter to delimit the content of a field value. For more information about delimiters, see Example.

string

No

The delimiter. You can specify a delimiter to delimit the content of a field value. For more information about delimiters, see Example.

include_keys

array

No

The included fields. You cannot specify both include_keys and exclude_keys.

string

No

The included field. You cannot specify both include_keys and exclude_keys.

exclude_keys

array

No

The excluded fields. You cannot specify both include_keys and exclude_keys.

string

No

The excluded field. You cannot specify both include_keys and exclude_keys.

ttl

integer

No

The retention period of logs. Unit: days. Valid values: 7, 30, and 90.

max_text_len

integer

No

The maximum length of a field value that can be retained. Default value: 2048. Unit: bytes. The default value is equal to 2 KB. You can change the value of max_text_len. Valid values: 64 to 16384.

log_reduce

boolean

No

Specifies whether to turn on LogReduce. After you turn on LogReduce, either the whitelist or blacklist takes effect.

log_reduce_white_list

array

No

The fields in the whitelist that you want to use to cluster logs.

string

No

The field in the whitelist that you want to use to cluster logs.

log_reduce_black_list

array

No

The fields in the blacklist that you want to use to cluster logs.

string

No

The field in the blacklist that you want to use to cluster logs.

Response elements

Element

Type

Description

Example

None defined.

Examples

Success response

JSON format

{}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.