Call the CreateDataTasks to create an index migration task to Data Transport from the selected cluster to the current cluster.
Before you call this operation, note that:
- Currently, the one-click index migration feature only supports the China (Beijing) region.
- The source and destination Elasticsearch clusters must meet the following requirements: The source is a user-created or Alibaba Cloud Elasticsearch Elasticsearch cluster of version 6.7.0, and the destination is a Alibaba Cloud Elasticsearch Elasticsearch cluster of version 6.3.2 or 6.7.0.
Debugging
Request parameters
This operation uses only common request headers. For more information, see Common request parameters.
Request structure
POST /openapi/instances/[InstanceId]/data-task HTTP/1.1
Request parameters
Parameter | Type | Location | Required | Example | Description |
---|---|---|---|---|---|
ClientToken | String | Query | Yes | 5A2CFF0E-5718-45B5-9D4D-70B3FF**** |
This parameter is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. |
InstanceId | String | Path | Yes | es-cn-n6w1o1x0w001c**** |
The ID of the destination cluster for index migration. |
RequestBody
You must also specify the following parameters in RequestBody to specify the migration information.
Parameter |
Type |
Required |
Example |
Description |
---|---|---|---|---|
sourceCluster |
Struts |
The information of the source cluster. |
||
└dataSourceType |
String |
Yes |
elasticsearch |
The type of the source cluster. The default value is Elasticsearch. |
└endpoint |
String |
No |
http://yourdomain.com |
The public domain name of the cluster. You can specify this parameter if the source cluster is Internet-enabled. |
└vpcInstancePort |
Integer |
No |
9200 |
The port number used to access the cluster. The source cluster uses VPC information to connect. |
└vpcId |
String |
No |
vpc-2ze59tt67m3nzkko9**** |
The ID of the VPC where the source cluster resides. The source cluster uses VPC information to connect. |
└vpcInstanceId |
String |
No |
es-xxx-worker |
The ID of the instance or Server Load Balancer (Server Load Balancer) instance of the current cluster. The source cluster uses VPC information to connect. |
└vpcIp |
String |
No |
10.10.xx.xx |
The IP address of the SLB instance in the cluster. The source cluster uses VPC information for connection |
└username |
String |
No |
elastic |
The logon username of the source cluster. |
└password |
String |
No |
xxxxx |
The logon password of the source cluster. |
└index |
String |
Yes |
index_001 |
The specified index of the source cluster. |
└type |
String |
Yes |
index_001 |
The type of the specified index. |
sinkCluster |
Struts |
The information about the target cluster. |
||
└dataSourceType |
String |
Yes |
elasticsearch |
The type of the target cluster. |
└username |
String |
Yes |
elastic |
The logon username of the target cluster. |
└password |
String |
Yes |
xxxxx |
The logon password of the target cluster. |
└index |
String |
Yes |
index_001 |
The specified index of the destination cluster. |
└type |
String |
Yes |
index_001 |
The type of the specified index. |
└settings |
String |
Yes |
{\n \"index\": {\n \"replication\": {\n \"type\": .....} |
Settings configuration. |
└mapping |
String |
Yes |
{\"doc\":{\"properties\":{\"interval_ms\":{\"type\":\"long\"},....} |
Mapping configuration. |
└routing |
String |
No |
_id |
The index route field. The primary key field is used by default. |
migrationConfig |
Struts |
No |
"sourceFilterParams": "index = 1" |
Migrate configurations. |
└filterParams |
String |
No |
index=111 |
The filter condition of the index. Filter documents with specified conditions for index reconstruction. |
- Public network enabled for the cluster: Enter the endpoint parameter to connect.
- Public network is not enabled for the cluster (or VPC information is used to connect to the cluster): Enter the parameters vpcInstancePort, vpcId, vpcInstanceId, or vpcInstancePort, vpcId, and vpcIp to connect.
Example:
- Access the cluster from the public network
{ "sourceCluster":{ "dataSourceType":"elasticsearch", "endpoint" : "http://es-cn-n6w1o1x0w001c****.public.elasticsearch.aliyuncs.com:9200", "username" : "elastic", "password" : "xxxxxx", "index" : "default", "type" : "default" }, "sinkCluster":{ "dataSourceType":"elasticsearch", "username" : "elastic", "password" : "xxxxxx", "index" : "default", "type" : "default", "settings" : "#settings configuration#", "mapping" : "#mapping configuration#", "routing" : "_id" }, "migrateConfig": { "sourceFilterParams": "" } }
- Alibaba Cloud Elasticsearch cluster
{ "sourceCluster":{ "dataSourceType" : "elasticsearch", "vpcInstancePort":9200, "vpcId":"vpc-2ze55voww95g82gak****", "vpcInstanceId":"es-cn-oew1oxiro000f****-worker", "username" : "elastic", "password" : "xxxxxx", "index" : "default", "type" : "default" }, "sinkCluster":{ "dataSourceType":"elasticsearch", "username" : "elastic", "password" : "xxxxxx", "index" : "default", "type" : "default", "settings" : "#settings configuration#", "mapping" : "#mapping configuration#", "routing" : "_id" }, "migrateConfig": { "sourceFilterParams": "" } }
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 5FFD9ED4-C2EC-4E89-B22B-1ACB6FE1**** |
The ID of the request. |
Result | Array of Result |
The return result of the video moderation task. |
|
sinkCluster | Struct |
The information about the target cluster. |
|
dataSourceType | String | elasticsearch |
The type of the target cluster. |
index | String | index_001 |
The name of the target index. |
mapping | String | {\"doc\":{\"properties\":{\"interval_ms\":{\"type\":\"long\"},....} |
Mapping configuration. |
password | String | xxxxx |
The access password of the target cluster. |
routing | String | cluster_name |
The routing field. The primary key field is used by default. |
settings | String | {\n \"index\": {\n \"replication\": {\n \"type\": .....} |
Settings configuration. |
type | String | index_001 |
The type of the target index. |
username | String | elastic |
The username of the target cluster. |
vpcId | String | vpc-2ze55voww95g82gak**** |
The ID of the Virtual Private Cloud where the cluster is located. The cluster access address is a public domain name, but the private endpoint is required. |
vpcInstanceId | String | es-cn-oew1oxiro000f****-worker |
The instance ID of the cluster under the Virtual Private Cloud, or the ID of the SLB instance. |
vpcInstancePort | String | 9200 |
The access port number of the cluster. |
sourceCluster | Struct |
The information of the source cluster. |
|
dataSourceType | String | elasticsearch |
The type of the source cluster. Default value: Elasticsearch. |
endpoint | String | http://10.20.xx.xx:9200 |
The public domain name of the cluster. |
index | String | index_001 |
Specifies the indexes to be migrated. |
password | String | xxxxxx |
The access password of the source cluster. |
type | String | index_001 |
The type of the specified index. |
username | String | elastic |
The username of the source cluster. |
vpcId | String | vpc-2ze55voww95g82gak**** |
The ID of the Virtual Private Cloud where the source cluster resides (the cluster access address is a public domain name, but the private endpoint is required). |
vpcInstanceId | String | es-cn-oew1oxiro000f****-worker |
The instance ID of the cluster under the Virtual Private Cloud, or the ID of the SLB instance. |
vpcInstancePort | Integer | 9200 |
The access port number of the source cluster. |
Examples
Sample requests
POST /openapi/instances/es-cn-n6w1o1x0w001c****/data-task HTTP/1.1
Common request headers
{
"sourceCluster":{
"dataSourceType":"elasticsearch",
"endpoint" : "http://es-cn-n6w1o1x0w001c****.public.elasticsearch.aliyuncs.com:9200",
"username" : "elastic",
"password" : "xxxxxx",
"index" : "default",
"type" : "default"
},
"sinkCluster":{
"dataSourceType":"elasticsearch",
"username" : "elastic",
"password" : "xxxxxx",
"index" : "default",
"type" : "default",
"settings" : "{\n \"index\": {\n \"replication\": {\n \"type\": .....}",
"mapping" : "{\"doc\":{\"properties\":{\"interval_ms\":{\"type\":\"long\"},....}",
"routing" : "_id"
},
"migrateConfig":{
"sourceFilterParams": "index = 1"
}
}
Successful response examples
JSON
format
{
"RequestId": "5FFD9ED4-C2EC-4E89-B22B-1ACB6FE1****",
"Result": [{
"sourceCluster": {
"password": "xxxxxx",
"endpoint": "http://10.20.xx.xx:9200",
"vpcId": "vpc-2ze55voww95g82gak****",
"vpcInstancePort": 9200,
"index": "index_001",
"type": "index_001",
"vpcInstanceId": "es-cn-oew1oxiro000f****-worker",
"dataSourceType": "elasticsearch",
"username": "elastic"
},
"sinkCluster": {
"routing": "cluster_name",
"settings": "{\\n \\\"index\\\": {\\n \\\"replication\\\": {\\n \\\"type\\\": .....}",
"password": "xxxxx",
"mapping": "{\\\"doc\\\":{\\\"properties\\\":{\\\"interval_ms\\\":{\\\"type\\\":\\\"long\\\"},....}",
"vpcInstancePort": 9200,
"vpcId": "vpc-2ze55voww95g82gak****",
"index": "index_001",
"type": "index_001",
"vpcInstanceId": "es-cn-oew1oxiro000f****-worker",
"dataSourceType": "elasticsearch",
"username": "elastic"
}
}]
}
Error codes
For a list of error codes, visit the API Error Center.