All Products
Search
Document Center

OpenSearch:CreateIndex

Last Updated:Oct 16, 2024

Creates an index.

Operation description

Method

POST

URI

/openapi/ha3/instances/{instanceId}/indexes

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
searchengine:CreateIndexcreate
  • Instance
    acs:searchengine:{#regionId}:{#accountId}:instance/{#InstanceId}
    none
none

Request syntax

POST /openapi/ha3/instances/{instanceId}/indexes HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
instanceIdstringYes

The instance ID.

ha-cn-2r42ppr7901
bodyobjectNo

The request body.

namestringNo

The index name.

ha-cn-zvp2qr1sk01_qrs
dataSourcestringNo

The name of the data source.

test1
domainstringNo

The data center in which the data source is deployed.

vpc_hz_domain_1
contentstringNo

The index schema.

{\"summarys\":{\"summary_fields\":[\"id\"]},\"indexs\":[{\"index_name\":\"index_id\",\"index_type\":\"PRIMARYKEY64\",\"index_fields\":\"id\",\"has_primary_key_attribute\":true,\"is_primary_key_sorted\":false}],\"attributes\":[\"id\"],\"fields\":[{\"field_name\":\"id\",\"field_type\":\"UINT16\"}],\"table_name\":\"index_2\"}
partitionintegerNo

The number of data shards.

20211202
dataSourceInfoobjectNo

The information about the data source. This parameter is required for an OpenSearch Vector Search Edition instance of the new version.

dataTimeSecintegerNo

The start timestamp from which incremental data is retrieved.

1709715164
processPartitionCountintegerNo

The number of resources used for data update.

4
namestringNo

The name of the data source.

ha-cn-35t3n1yuj0d_index_1
typestringNo

The type of the data source. Valid values:

  • odps
  • swift
  • saro
  • oss
odps
domainstringNo

The data center in which the data source is deployed.

vpc_hz_domain_1
configobjectNo

The information about the MaxCompute data source.

endpointstringNo

The endpoint of the MaxCompute or Object Storage Service (OSS) data source.

https://oss-cn-hangzhou.aliyuncs.com
accessKeystringNo

The AccessKey ID of the MaxCompute data source.

L***p
accessSecretstringNo

The AccessKey secret of the MaxCompute data source.

5**9a6
projectstringNo

The name of the MaxCompute project that is used as the data source.

bbt_algo_pai
partitionstringNo

The partition in the MaxCompute table. This parameter is required if type is set to odps.

ds=20230114
tablestringNo

The table name.

bbt_rec_swing_u2i2i_score_be_v1
namespacestringNo

The namespace name.

test-namespace
pathstringNo

The path of the Apsara File Storage for HDFS data source.

test-hdfs-path
ossPathstringNo

The path of the OSS object.

/opensearch/oss.json
bucketstringNo

The name of the OSS bucket.

test-bucket
saroConfigobjectNo

The configurations of the SARO data source.

namespacestringNo

The namespace of the SARO data source.

flink-test-fjx-default
tableNamestringNo

The name of the SARO table.

device_event_shy_summary_
autoBuildIndexbooleanNo

Specifies whether to enable automatic full indexing.

true
processParallelNumintegerNo

The maximum number of full indexes that can be concurrently processed.

2
extendobjectNo

The extended content of the field configuration. key specifies the vector field and the field that requires embedding.

{ "vector": [ "source_image_vector" ], "embeding": [ "source_image" ], "description": [] }
buildParallelNumintegerNo

The maximum number of full indexes that can be concurrently built.

2
mergeParallelNumintegerNo

The maximum number of full indexes that can be concurrently merged.

2
dryRunbooleanNo

Specifies whether to perform only a dry run, without performing the actual request. The system only checks the validity of the data source. Valid values:

  • true
  • false
true

Sample requests

POST /openapi/ha3/instances/ose-test1/indexes
{
    "name": "aaa",

    "dataSource": "beixuan_test",

    "domain": "test", // Specifies where the data source is deployed.

    "content": "",

    "partition": 2

}

Response parameters

ParameterTypeDescriptionExample
object

The results returned.

requestIdstring

The request ID.

407BFD91-DE7D-50BA-8F88-CDE52A3B5E46
resultobject

The results returned.

{}

Sample responses

Success responses

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

For more information, see Response struct.

Examples

Sample success responses

JSONformat

{
  "requestId": "407BFD91-DE7D-50BA-8F88-CDE52A3B5E46",
  "result": {}
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-05-16The internal configuration of the API is changed, but the call is not affectedView Change Details
2024-03-06The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-07-20The request parameters of the API has changedView Change Details
2022-01-12Add OperationView Change Details