All Products
Search
Document Center

AnalyticDB:CreateVectorIndex

Last Updated:Nov 01, 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.

Create Vector Index

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

Request parameters

ParameterTypeRequiredDescriptionExample
DBInstanceIdstringYes

Instance ID.

Note You can call the DescribeDBInstances API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.
gp-xxxxxxxxx
CollectionstringYes

Collection name.

Note You can use the ListCollections API to view the list.
document
DimensionintegerYes

Vector dimension.

Note This value must be consistent with the length of the vector data (Rows. Vector) uploaded via the UpsertCollectionData API.
1024
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

Management account password.

testpassword
MetricsstringNo

Method used for building the vector index. Value description:

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

Namespace, default is public.

Note You can use the ListNamespaces API to view the list.
mynamespace
RegionIdstringYes

Region ID where the instance is located.

cn-hangzhou
PqEnableintegerNo

Whether to enable PQ (Product Quantization) algorithm acceleration for the index. It is recommended to enable this when the data volume exceeds 500,000. Value description:

  • 0: Disabled.
  • 1: Enabled (default).
1
HnswMintegerNo

The maximum number of neighbors in the HNSW algorithm, ranging from 1 to 1000. The API will automatically set this value based on the vector dimension, and it generally does not need to be manually set.

Note It is suggested to set this based on the vector dimension as follows:
  • Less than or equal to 384: 16
  • Greater than 384 and less than or equal to 768: 32
  • Greater than 768 and less than or equal to 1024: 64
  • Greater than 1024: 128
  • 64
    ExternalStorageintegerNo

    Whether to use mmap to build the HNSW index, default is 0. If the data does not need to be deleted and there are performance requirements for uploading data, it is recommended to set this to 1.

    Note
  • When set to 0, the segment-page storage mode is used to build the index, which can use the shared_buffer in PostgreSQL for caching and supports deletion and update operations.
  • When set to 1, the index is built using mmap, which does not support deletion and update operations.
  • 0

    Response parameters

    ParameterTypeDescriptionExample
    object
    RequestIdstring

    Request ID.

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

    Detailed information returned by the API.

    Successful
    Statusstring

    API execution status. Value description:

    • success: Execution succeeded.
    • fail: Execution failed.
    success

    Examples

    Sample success responses

    JSONformat

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

    Error codes

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

    Change history

    Change timeSummary of changesOperation
    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