Vector search

更新时间:
复制 MD 格式

This topic describes how to retrieve vectors in DashVector using the console, an SDK, or an API.

Using the console

  1. Log on to the Vector Retrieval Service DashVector console.

  2. In the navigation pane on the left, click Cluster List. Select the collection from which you want to retrieve vectors and click Details.image

  1. In the left-side secondary navigation pane, click Similar Vector Search. Fill in the required information and click Search. The search returns the results for similar vectors.

    1. Vector search in a single-vector collectionimageThe parameters for the vector search are described below.

      Parameter

      Corresponding API parameter name

      Description

      Required

      Query Vector

      vector

      The vector data. For example, `[1.0,2.0,3.0,4.0]`.

      Note

      The vector dimensions and data type must be the same as those of the collection.

      Yes

      Filter Condition

      filter

      The filter condition. It must follow the SQL `WHERE` clause specification. For more information, see Filtered search.

      No

      Partition

      partition

      The partition name. The default value is `default`. Select a partition as needed.

      Yes

      TopK

      topk

      The maximum number of vectors to return. The default value is 10. The maximum value is 1024.

      Yes

      The parameters in the returned results are described below.

      Parameter

      Corresponding API parameter name

      Description

      Distance

      score

      Vector similarity.

      • The numeric representation of the distance between vectors varies with the distance metric. For more information, see What is a vector?.

      • The results are sorted by vector similarity in descending order.

      Primary Key ID

      id

      The primary key ID of the similar vector.

      Vector

      vector

      The vector data. For example, [1.0,2.0,3.0,4.0].

      Fields

      fields

      The JSON field parameters. For example, {"price":100,"type":"dress"}.

      Partition

      partition

      The partition where the similar vector is located.

    2. Vector search in a multi-vector collection

      Note
      • Click Add Query Vector to add a record. The number of query vectors cannot exceed the number of vector fields defined in the collection.

      • Click the delete button on the right to delete the record.

      The parameters for the vector search are described below.

      Parameter

      Corresponding API parameter name

      Description

      Required

      Vector Name

      {VectorName}

      Custom: The following requirements must be met:

      • The name must be 3 to 32 characters in length.

      • The name must consist of uppercase letters, lowercase letters, digits, underscores (_), and hyphens (-). For example, `vector1`, `vector_1`, or `vector_a_name`.

      • The vector name must be unique within the collection. Two identical vector names cannot exist at the same time.

      Note
      • You can only select a vector name that was specified when the collection was created.

      Yes

      Query Vector

      vector

      The vector data. For example, `[1.0,2.0,3.0,4.0]`.

      Note

      The vector dimensions and data type must be the same as those defined when the collection was created.

      Yes

      Number of candidate vectors

      num_candidates

      The number of results to recall for a single vector. The default value is the same as `topk` (10).

      No

      Weight

      Optional[Dict[str, float]

      This parameter is required only when **Sorting Method** is set to **WeightRank**. By default, the weights are equal (1.0:1.0:1.0...). For more information, see WeightedRanker.

      Yes

      Sorting Method

      RrfRanker/

      WeightedRanker

      Supports RRFRank and WeightRank. For more information, see RrfRanker and WeightedRanker.

      Yes

      Constant

      rank_constant

      This parameter is valid only when **Sorting Method** is set to **RRFRank**. For example, if `rank_constant` is 10, the 10 most similar results are returned for each vector. The default value is 60. For more information, see RrfRanker.

      Yes

      Filter Condition

      filter

      The filter condition. It must follow the SQL `WHERE` clause specification. For more information, see Filtered search.

      No

      Partition

      partition

      The partition name. The default value is `default`. Select a partition as needed.

      Yes

      TopK

      topk

      The maximum number of vectors to return. The default value is 10. The maximum value is 1024.

      Yes

      The parameters in the returned results are described below.

      Parameter

      Corresponding API parameter name

      Description

      Distance

      score

      Vector similarity.

      • The numeric representation of the distance between vectors varies with the distance metric. For more information, see What is a vector?.

      • The results are sorted by vector similarity in descending order.

      Primary Key ID

      id

      The primary key ID of the similar vector.

      Vector

      vector

      The vector data. For example, [1.0,2.0,3.0,4.0].

      Properties

      fields

      The JSON field parameters. For example, {"price":100,"type":"dress"}.

      Partition

      partition

      The partition where the similar vector is located.

Using an SDK

Using an API

To retrieve vectors using the HTTP API, see Retrieve documents.