CreateIndexTemplate
Creates a cluster index template for component-based configuration of index templates.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
elasticsearch:CreateIndexTemplate |
none |
*All Resource
|
None | None |
Request syntax
POST /openapi/instances/{InstanceId}/index-templates HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The instance ID. |
es-cn-n6w24n9u900am**** |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ClientToken |
string |
No |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. |
E1136AE9-4E49-4585-9358-6FDD2A6D**** |
| body |
object |
No |
The request body parameters, which are used to specify the information about the cluster index template to be created. |
{ "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 |
Yes |
The name of the index template. |
index-template |
| indexPatterns |
array |
Yes |
The regular expression for the index pattern. |
|
|
string |
Yes |
The regular expression for the index pattern. |
["schema1*","schema2*"] |
|
| dataStream |
boolean |
Yes |
Specifies whether to enable the data stream. Valid values:
|
false |
| priority |
integer |
No |
The priority of the cluster index template. A larger value indicates a higher priority. |
30 |
| ilmPolicy |
string |
No |
The name of the lifecycle policy. |
policy-1 |
| template |
object |
No |
The template settings. For more information, see Multiple Component Templates. |
|
| settings |
string |
No |
The settings. |
{\"index.number_of_shards\":\"1\"} |
| mappings |
string |
No |
The mappings. |
{\"properties\":{\"created_at\":{\"format\":\"EEE MMM dd HH:mm:ss Z yyyy\",\"type\":\"date\"},\"host_name\":{\"type\":\"keyword\"}}} |
| aliases |
string |
No |
The aliases. |
{\"mydata\":{}} |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Result |
string |
The name of the created cluster index template. |
index-template |
| RequestId |
string |
The request ID. |
F99407AB-2FA9-489E-A259-40CF6DCC**** |
Examples
Success response
JSON format
{
"Result": "index-template",
"RequestId": "F99407AB-2FA9-489E-A259-40CF6DCC****"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.