All Products
Search
Document Center

:CreateCollection

更新時間:Sep 14, 2024

Creates a vector collection.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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
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
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
  • 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"}
RegionIdstringYes

The region ID of the instance.

cn-hangzhou
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

Response parameters

ParameterTypeDescriptionExample
object
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