特定の Logstore に対してインデックスを作成します。
例:
POST /logstores/{logstoreName}/index
リクエスト構文
POST /logstores/<logstoreName>/index HTTP/1.1
Authorization: <AuthorizationString>
x-log-bodyrawsize: <x-log-bodyrawsize>
User-Agent: <User-Agent>
x-log-apiversion: <APIVersion>
Host: <Project Endpoint>
x-log-signaturemethod: hmac-sha1
Date: <GMT Date>
Content-Type: application/json
Content-MD5: <Content-MD5>
Content-Length: <Content-Length>
{
"line": <full text index>,
"keys": <key-value index>
}
リクエストパラメーター
属性名 | データ型 | 必須/省略可能 | 説明 |
---|---|---|---|
logstoreName | string | 必須 | Logstore 名 |
keys | object | 省略可能 | キー値のインデックス設定 キーはフィールド名、値はインデックス設定を示します。 |
行 | object | 省略可能 | フルテキストインデックス設定 |
キーまたは行のいずれかを指定します。 フルテキストインデックス設定には以下の属性が含まれます。
属性名 | データ型 | 必須/省略可能 | 説明 |
---|---|---|---|
caseSensitive | bool | 省略可能 | 大文字小文字の区別 |
chn | bool | 省略可能 | 中国語を含むかどうか |
token | array | 必須 | 単語分割リスト |
include_keys | array | 省略可能 | 含まれるフィールドのリストと属性を exclude_keys で同時に指定することはできません。 |
exclude_keys | array | 省略可能 | 含まれるフィールドのリストと属性を exclude_keys で同時に指定することはできません。 |
フィールドインデックス設定には以下の属性が含まれます。
属性名 | データ型 | 必須 | 説明 |
---|---|---|---|
type | string | 必須 | フィールドのタイプ |
alias | string | 省略可能 | フィールドのエイリアス |
chn | bool | 省略可能 | 中国語を含めるかどうか データ型の値がテキストの場合のみ、このフィールドは有用です。 |
token | array | データ型の値がテキストの場合のみこのフィールドが必要になります。 | 単語分割リスト このフィールドはデータ型の値がテキストの場合のみ有用です。 |
caseSensitive | bool | 省略可能 | 大文字と小文字の区別 このフィールドはデータ型の値がテキストの場合のみ意味をなします。 |
doc_value | bool | 省略可能 | フィールド上での統計分析を有効 / 無効にします。 |
CreateIndex インターフェースに特別のリクエストヘッダーはありません。 Log Service API のパブリックリクエストヘッダーの詳細については、「パブリックリクエストヘッダー」をご覧ください。
レスポンスヘッダーCreateIndex インターフェースに特別のリクエストヘッダーはありません。 Log Service API のパブリックレスポンスヘッダーの 詳細については、以下をご参照ください。パブリックレスポンスヘッダー.
レスポンス要素返された HTTP ステータスコードは 200 です。
エラーコードLog Service API の 一般的なエラー コード に加えて、インターフェースから以下のエラーコードが返される場合があります。
HTTP ステータスコード | エラーコード | エラーメッセージ |
---|---|---|
400 | IndexInfoInvalid | required field token is lacking or of error format |
400 | IndexAlreadyExist | log store index is already created |
404 | ProjectNotExist | The Project does not exist : {Project} |
404 | LogStoreNotExist | logstore {logstoreName} dose not exist |
500 | InternalServerError | Specified Server Error Message |
注 上記の表のエラーメッセージにおいて、 {Project} と {logstoreName} はこのセクションが特定のプロジェクト名と Logstore 名で置き換えられることを示しています。
例
リクエストの例
POST /logstores/my-logstore/index HTTP/1.1
Authorization: LOG <yourAccessKeyId>:<yourSignature>
x-log-bodyrawsize: 0
User-Agent: sls-java-sdk-v-0.6.1
x-log-apiversion: 0.6.0
Host: my-project.cn-shanghai.log.aliyuncs.com
x-log-signaturemethod: hmac-sha1
Date: Mon, 07 May 2018 09:43:16 GMT
Content-Type: application/json
Content-MD5: 22876515FC311F857AD6C7902F6A0148
Content-Length: 316
Connection: Keep-Alive
{
"line": {
"token": [
",",
" ",
"'",
"\"",
";",
"=",
"(",
")",
"[",
"]",
"{",
"}",
"?",
"@",
"&",
"<",
">",
"/",
":",
"\n",
"\t",
"\r"
]
},
"keys": {
"agent": {
"doc_value": true,
"caseSensitive": true,
"alias": "agent_alias",
"type": "text",
"token": [
",",
" ",
"'",
"\"",
";",
"=",
"(",
")",
"[",
"]",
"{",
"}",
"?",
"@",
"&",
"<",
">",
"/",
":",
"\n",
"\t",
"\r"
]
}
}
}