All Products
Search
Document Center

OpenSearch:CreateDataSource

Last Updated:Dec 24, 2025

Creates a data source.

Operation description

Method

POST

URI

/openapi/ha3/instances/{instanceId}/data-sources

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

searchengine:CreateDataSource

create

*Instance

acs:searchengine:{#regionId}:{#accountId}:instance/{#InstanceId}

None None

Request syntax

POST /openapi/ha3/instances/{instanceId}/data-sources HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

instanceId

string

Yes

The instance ID.

ha-cn-pl32rf0****

Request parameters

Parameter

Type

Required

Description

Example

dryRun

boolean

No

Specifies whether to perform a dry run to check the request. A dry run checks the validity of the data source without creating it. Valid values: true and false.

true

body

object

No

The request body.

{}

name

string

No

The name of the data source.

ha-cn-pl32rf0****_test_api

type

string

No

The type of the data source. Valid values: odps, oss, and swift.

odps

domain

string

No

The data center where the data source is located.

vpc_hz_domain_1

config

object

No

The data source configuration.

endpoint

string

No

The endpoint of the MaxCompute or OSS data source.

http://service.cn-hangzhou.maxcompute.aliyun-inc.com/api

accessKey

string

No

The AccessKey ID for the MaxCompute data source.

L***p

accessSecret

string

No

The AccessKey secret for the MaxCompute data source.

5**9a6

project

string

No

The name of the MaxCompute project.

kubenest

partition

string

No

The partition in the MaxCompute table.

ds=20220713

table

string

No

The name of the MaxCompute table.

item

namespace

string

No

The namespace.

aegis-ops

path

string

No

The path of the HDFS file.

test-hdfs-path

ossPath

string

No

The path of the OSS file.

/opensearch/search

bucket

string

No

The name of the OSS bucket.

opensearch

catalog

string

No

database

string

No

tag

string

No

saroConfig

object

No

The configuration of the saro data source.

namespace

string

No

The namespace of the saro data source.

igraph-cn-x0r3e3abe02

tableName

string

No

The name of the saro data table.

index_hdfs

autoBuildIndex

boolean

No

Specifies whether to automatically reindex the data source after it is created.

true

Request example

POST /openapi/ha3/instances/ha-cn-pl32rf0****/data-sources

{
  "name": "data_source_name",
  "type": "odps",
  "config":{
    "accessKey": "xxx",
    "accessSecret": "xxxs",
    "project":"xxxx",
    "table":"xxx",
    "partition":"xxxx"
  },
  "autoBuildIndex": true
}

Response elements

Element

Type

Description

Example

object

requestId

string

The ID of the request.

10D5E615-69F7-5F49-B850-00169ADE513C

result

object

The returned result.

{}

Response examples

Success response

{
	"requestId": "0A6EB64B-B4C8-CF02-810F-E660812972FF",
    "result": {}
}

Error response

{
	"requestId": "0A6EB64B-B4C8-CF02-810F-E660812972FF",
    "result": {
       "success": false,
       "data": "some error message"
  }
}

For more information, see Response structure.

Examples

Success response

JSON format

{
  "requestId": "10D5E615-69F7-5F49-B850-00169ADE513C",
  "result": {}
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.