全部產品
Search
文件中心

Simple Log Service:CreateIndex

更新時間:Sep 15, 2026

為指定 Logstore 建立索引。

介面說明

Host 由 Project 名稱和日誌服務 Endpoint 構成,您需要在 Host 中指定 Project。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

log:CreateIndex

create

*LogStore

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

  • log:TLSVersion
無

請求文法

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

路徑參數

名稱

類型

必填

描述

樣本值

logstore

string

是

Logstore 的名稱。

ali-logstore-test

請求參數

名稱

類型

必填

描述

樣本值

project

string

是

Project 名稱。

ali-project-test

body

object

否

請求訊息體。

keys

object

否

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

否

The index configuration of the field.

caseSensitive

boolean

否

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

  • true

  • false (default)

chn

boolean

否

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

  • true

  • false (default)

type

string

否

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

alias

string

否

The alias of the field.

token

array

否

The delimiters that are used to split text.

string

否

The delimiter.

doc_value

boolean

否

Specifies whether to turn on Enable Analytics for the field.

line

object

否

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

chn

boolean

否

Specifies whether to include Chinese characters. Valid values:

  • true

  • false (default)

caseSensitive

boolean

否

Specifies whether to enable case sensitivity. Valid values:

  • true

  • false (default)

token

array

是

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

string

否

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

否

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

string

否

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

exclude_keys

array

否

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

string

否

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

ttl

integer

否

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

max_text_len

integer

否

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

否

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

log_reduce_white_list

array

否

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

string

否

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

log_reduce_black_list

array

否

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

string

否

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

返回參數

名稱

類型

描述

樣本值

當前API暫無返回參數

樣本

正常返回樣本

JSON格式

{}

錯誤碼

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情。