All Products
Search
Document Center

AnalyticDB:CreateCollection

Last Updated:Nov 05, 2024
This topic is generated by a machine translation engine without any human intervention. ALIBABA CLOUD DOES NOT GUARANTEE THE ACCURACY OF MACHINE TRANSLATED CONTENT. To request a human-translated version of this topic or provide feedback on this translation, please include it in the feedback form.

Creates a vector collection.

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
gpdb:CreateCollectioncreate
  • Collection
    acs:gpdb:{#regionId}:{#accountId}:collection/{#DBInstanceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DBInstanceIdstringNo

The instance ID.

Note You can call the DescribeDBInstances operation to query the IDs of all AnalyticDB for PostgreSQL instances in a specific region.
gp-xxxxxxxxx
ManagerAccountstringYes

Name of the management account with rds_superuser permissions.

Note You can create an account through the console -> Account Management, or by using the CreateAccount API.
testaccount
ManagerAccountPasswordstringYes

The password of the manager account.

testpassword
NamespacestringNo

The name of the namespace.

Note You can call the CreateNamespace operation to create a namespace and call the ListNamespaces operation to query a list of namespaces.
mynamespace
CollectionstringYes

The name of the collection that you want to create.

Note The name must comply with the naming conventions of PostgreSQL objects.
document
DimensionlongNo

The number of vector dimensions.

Note If you specify this parameter, an index is created. When you call the UpsertCollectionData operation, make sure that the length of the Rows.Vector parameter is the same as the value of this parameter. If you do not specify this parameter, you can call the CreateVectorIndex operation to create an index.
1024
FullTextRetrievalFieldsstringNo

Fields used for full-text search, separated by commas (,). These fields must be keys defined in Metadata.

title,content
MetadatastringYes

The metadata of the vector data, which is a JSON string in the MAP format. The key specifies the field name, and the value specifies the data type.

Note Supported data types:
  • For information about the supported data types, see Data types.

  • The money data type is not supported.

**

Warning Reserved fields such as id, vector, to_tsvector, and source cannot be used.

{"title":"text","content":"text","response":"int"}
ParserstringNo

The analyzer that is used for full-text search.

zh_cn
RegionIdstringYes

The region ID of the instance.

cn-hangzhou
MetricsstringNo

Method used when building the vector index.

Value description:

  • l2: Euclidean distance.
  • ip: Inner product (dot product) distance.
  • cosine (default): Cosine similarity.
cosine
HnswMintegerNo

The maximum number of neighbors for the Hierarchical Navigable Small World (HNSW) algorithm. Valid values: 1 to 1000. In most cases, this parameter is automatically configured based on the value of the Dimension parameter. You do not need to configure this parameter.

Note We recommend that you configure this parameter based on the value of the Dimension parameter.

*If you set Dimension to a value less than or equal to 384, set the value of HnswM to 16.

*If you set Dimension to a value greater than 384 and less than or equal to 768, set the value of HnswM to 32.

*If you set Dimension to a value greater than 768 and less than or equal to 1024, set the value of HnswM to 64.

*If you set Dimension to a value greater than 1024, set the value of HnswM to 128.

64
PqEnableintegerNo

Specifies whether to enable the product quantization (PQ) feature for index acceleration. We recommend that you enable this feature for more than 500,000 rows of data. Valid values:

  • 0: no.
  • 1 (default): yes.
0
ExternalStorageintegerNo

Specifies whether to use the memory mapping technology to create HNSW indexes. Valid values: 0 and 1. Default value: 0. We recommend that you set the value to 1 in scenarios that require upload speed but not data deletion.

Note
  • 0: uses segmented paging storage to create indexes. This method uses the shared buffer of PostgreSQL for caching and supports the delete and update operations.

  • 1: uses the memory mapping technology to create indexes. This method does not support the delete or update operation.

0
WorkspaceIdstringNo

The ID of the workspace that consists of multiple AnalyticDB for PostgreSQL instances. You must specify one of the WorkspaceId and DBInstanceId parameters. If you specify both parameters, the WorkspaceId parameter takes effect.

gp-ws-*****

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

ABB39CC3-4488-4857-905D-2E4A051D0521
Messagestring

Return message.

create successfully
Statusstring

The status of the operation. Valid values:

  • success
  • fail
success

Examples

Sample success responses

JSONformat

{
  "RequestId": "ABB39CC3-4488-4857-905D-2E4A051D0521",
  "Message": "create successfully",
  "Status": "success"
}

Error codes

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

Change history

Change timeSummary of changesOperation
2024-08-04The request parameters of the API has changedView Change Details
2024-01-09The request parameters of the API has changedView Change Details
2023-11-07The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-08-08The request parameters of the API has changedView Change Details