調(diào)用CreateComponentIndex,創(chuàng)建Elasticsearch組合模板。

詳細(xì)信息請參見通過OpenStore實現(xiàn)海量數(shù)據(jù)存儲。

調(diào)試

您可以在OpenAPI Explorer中直接運(yùn)行該接口,免去您計算簽名的困擾。運(yùn)行成功后,OpenAPI Explorer可以自動生成SDK代碼示例。

請求頭

該接口使用公共請求頭,無特殊請求頭。請參見公共請求參數(shù)文檔。

請求語法

POST /openapi/instances/{InstanceId}/component-index/{name} HTTP/1.1

請求參數(shù)

名稱 類型 位置 是否必選 示例值 描述
InstanceId String Path es-cn-tl329rbpc0001****

實例ID。

name String Path template

模板名稱。

Object Body

請求體信息。

template Object Body

組合模板信息。

settings Map Body { "index.number_of_replicas": 0 }

模板settings配置。

mappings Map Body { "properties": { "@timestamp": { "type": "date" } } }

模板mappings配置。

aliases Map Body {}

模板別名配置。

_meta Map Body { "description": "set number of shards to one" }

元數(shù)據(jù),用于存儲備注等信息。

返回數(shù)據(jù)

名稱 類型 示例值 描述
RequestId String C20022BA-5382-4339-89FB-30AF48A05431

請求ID。

Result Boolean true

返回結(jié)果:

  • true:創(chuàng)建成功
  • false:創(chuàng)建失敗

示例

請求示例

POST /openapi/instances/es-cn-tl329rbpc0001****/component-index/template HTTP/1.1
Host:elasticsearch.aliyuncs.com
Content-Type:application/json

{
	"template": {
		"settings": {
			"index.number_of_replicas": 0
		},
		"mappings": {
			"properties": {
				"@timestamp": {
					"type": "date"
				}
			}
		},
		"aliases": {}
	},
  "_meta": {
      "description": "set number of shards to one"
  }
}

正常返回示例

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Result" : true,
  "RequestId" : "C20022BA-5382-4339-89FB-30AF48A05431"
}

錯誤碼

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