CreateCollection
Create a vector dataset.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
gpdb:CreateCollection |
create |
*Collection
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| DBInstanceId |
string |
No |
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-bp152460513z**** |
| ManagerAccount |
string |
Yes |
The name of the management account that has the Note
You can call the CreateAccount operation to create an account. |
testaccount |
| ManagerAccountPassword |
string |
Yes |
The password of the management account. |
testpassword |
| Namespace |
string |
No |
The namespace. Note
You can call the CreateNamespace operation to create a namespace or the ListNamespaces operation to list existing namespaces. |
mynamespace |
| Collection |
string |
Yes |
The name of the collection to create. Note
The name must comply with PostgreSQL object naming conventions. |
document |
| Dimension |
integer |
No |
The vector dimension. Note
If you specify this parameter, a vector index is created. In subsequent calls to the UpsertCollectionData operation, the length of |
1024 |
| FullTextRetrievalFields |
string |
No |
The fields to use for full-text search. Use commas ( |
title,content |
| Metadata |
string |
Yes |
A JSON string that defines the metadata schema as a map. The keys are field names, and the values are their corresponding data types. Note
Supported data types
Warning The field names id, vector, to_tsvector, and source are reserved and cannot be used. |
{"title":"text","content":"text","response":"int"} |
| Parser |
string |
No |
The parser for full-text search. The default is |
zh_cn |
| RegionId |
string |
Yes |
The ID of the region where the instance is located. |
cn-hangzhou |
| Metrics |
string |
No |
The distance metric used to build the vector index. Valid values:
|
cosine |
| HnswM |
integer |
No |
The maximum number of neighbors for the HNSW algorithm. You do not typically need to set this parameter, as the system automatically determines a value based on the vector dimension. Note
Value range:
Note
We recommend that you set this parameter based on the vector dimension:
|
64 |
| HnswEfConstruction |
string |
No |
The size of the candidate set for HNSW index construction. The value must be greater than or equal to Note
Value range:
|
128 |
| PqEnable |
integer |
No |
Specifies whether to enable Product Quantization (PQ) for index acceleration. This is recommended for datasets with more than 500,000 entries. Valid values:
|
1 |
| ExternalStorage |
integer |
No |
Specifies whether to use Valid values:
Important The ExternalStorage parameter is available only for AnalyticDB for PostgreSQL v6.0 instances and is not supported in v7.0. |
0 |
| WorkspaceId |
string |
No |
The ID of the workspace, which contains multiple database instances. You must specify either |
gp-ws-***** |
| MetadataIndices |
string |
No |
The scalar index fields. Separate multiple fields with commas ( |
title |
| SupportSparse |
boolean |
No |
Specifies whether to enable support for sparse vectors. The default value is |
true |
| SparseVectorIndexConfig |
object |
No |
The configuration for the sparse vector index. If specified, a sparse vector index is created. |
|
| HnswM |
integer |
No |
The maximum number of neighbors for the HNSW algorithm. You do not typically need to set this parameter, as the system automatically determines a value based on the vector dimension. Note
Value range:
Note
We recommend that you set this parameter based on the vector dimension:
|
64 |
| HnswEfConstruction |
integer |
No |
The size of the candidate set for HNSW index construction. The value must be an integer from 4 to 1,000. The default is 64. Note
This parameter is required only for AnalyticDB for PostgreSQL V7.0 instances, and its value must be greater than or equal to |
128 |
| Algorithm |
string |
No |
The vector index algorithm. Valid values:
|
hnswflat |
| VectorIndexConfig |
object |
No |
The configuration for the dense vector index. |
|
| Nlist |
integer |
No |
The number of lists (partitions) for a |
256 |
| RabitqBits |
integer |
No |
The number of bits for |
3 |
| Algorithm |
string |
No |
The vector index algorithm. Valid values:
|
hnswflat |
After creating a collection, use DescribeCollection to view it.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
ABB39CC3-4488-4857-905D-2E4A051D0521 |
| Message |
string |
The response message. |
create successfully |
| Status |
string |
The status of the operation. Valid values:
|
success |
Examples
Success response
JSON format
{
"RequestId": "ABB39CC3-4488-4857-905D-2E4A051D0521",
"Message": "create successfully",
"Status": "success"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.