创建集群索引模板,可用于索引模版的组件化设置。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
elasticsearch:CreateIndexTemplate |
none |
*全部资源
|
无 | 无 |
请求语法
POST /openapi/instances/{InstanceId}/index-templates HTTP/1.1
路径参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| InstanceId |
string |
是 |
实例 ID。 |
es-cn-n6w24n9u900am**** |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| ClientToken |
string |
否 |
用于保证请求的幂等性。由客户端生成该参数值,要保证在不同请求间唯一,最大不超过 64 个 ASCII 字符。 |
E1136AE9-4E49-4585-9358-6FDD2A6D**** |
| body |
object |
否 |
请求体参数,用来指定待创建的集群索引模板的信息。 |
{ "indexTemplate": "index-template", "indexPatterns": [ "schema1*", "schema2*" ], "dataStream": true, "priority": 30, "ilmPolicy": "policy-1", "template": { "settings": "{\"index.number_of_shards\":\"1\"}", "mappings": "{\"properties\":{\"created_at\":{\"format\":\"EEE MMM dd HH:mm:ss Z yyyy\",\"type\":\"date\"},\"host_name\":{\"type\":\"keyword\"}}}", "aliases": "{\"mydata\":{}}" } } |
| indexTemplate |
string |
是 |
索引模版名称。 |
index-template |
| indexPatterns |
array |
是 |
索引匹配模式正则。 |
|
|
string |
是 |
索引匹配模式正则。 |
["schema1*","schema2*"] |
|
| dataStream |
boolean |
是 |
是否开启数据流。可选值:
|
false |
| priority |
integer |
否 |
集群索引模板的优先级。 |
30 |
| ilmPolicy |
string |
否 |
生命周期策略名称。 |
policy-1 |
| template |
object |
否 |
模版设置,详细信息请参见官方 Multiple Component Templates 文档。 |
|
| settings |
string |
否 |
settings 设置。 |
{\"index.number_of_shards\":\"1\"} |
| mappings |
string |
否 |
mappings 设置。 |
{\"properties\":{\"created_at\":{\"format\":\"EEE MMM dd HH:mm:ss Z yyyy\",\"type\":\"date\"},\"host_name\":{\"type\":\"keyword\"}}} |
| aliases |
string |
否 |
aliases 设置。 |
{\"mydata\":{}} |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| Result |
string |
返回创建集群索引模板的名称。 |
index-template |
| RequestId |
string |
请求 ID。 |
F99407AB-2FA9-489E-A259-40CF6DCC**** |
示例
正常返回示例
JSON格式
{
"Result": "index-template",
"RequestId": "F99407AB-2FA9-489E-A259-40CF6DCC****"
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。