Skip to content

/AWS1/IF_S3V=>LISTVECTORS()

About ListVectors

Amazon S3 Vectors is in preview release for Amazon S3 and is subject to change.

List vectors in the specified vector index. To specify the vector index, you can either use both the vector bucket name and the vector index name, or use the vector index Amazon Resource Name (ARN).

ListVectors operations proceed sequentially; however, for faster performance on a large number of vectors in a vector index, applications can request a parallel ListVectors operation by providing the segmentCount and segmentIndex parameters.

Permissions

You must have the s3vectors:ListVectors permission to use this operation. Additional permissions are required based on the request parameters you specify:

  • With only s3vectors:ListVectors permission, you can list vector keys when returnData and returnMetadata are both set to false or not specified..

  • If you set returnData or returnMetadata to true, you must have both s3vectors:ListVectors and s3vectors:GetVectors permissions. The request fails with a 403 Forbidden error if you request vector data or metadata without the s3vectors:GetVectors permission.

Method Signature

IMPORTING

Optional arguments:

iv_vectorbucketname TYPE /AWS1/S3VVECTORBUCKETNAME /AWS1/S3VVECTORBUCKETNAME

The name of the vector bucket.

iv_indexname TYPE /AWS1/S3VINDEXNAME /AWS1/S3VINDEXNAME

The name of the vector index.

iv_indexarn TYPE /AWS1/S3VINDEXARN /AWS1/S3VINDEXARN

The Amazon resource Name (ARN) of the vector index.

iv_maxresults TYPE /AWS1/S3VLISTVECTORSMAXRESULTS /AWS1/S3VLISTVECTORSMAXRESULTS

The maximum number of vectors to return on a page.

If you don't specify maxResults, the ListVectors operation uses a default value of 500.

If the processed dataset size exceeds 1 MB before reaching the maxResults value, the operation stops and returns the vectors that are retrieved up to that point, along with a nextToken that you can use in a subsequent request to retrieve the next set of results.

iv_nexttoken TYPE /AWS1/S3VLISTVECTORSNEXTTOKEN /AWS1/S3VLISTVECTORSNEXTTOKEN

Pagination token from a previous request. The value of this field is empty for an initial request.

iv_segmentcount TYPE /AWS1/S3VLISTVECTORSSEGMENTCNT /AWS1/S3VLISTVECTORSSEGMENTCNT

For a parallel ListVectors request, segmentCount represents the total number of vector segments into which the ListVectors operation will be divided. The value of segmentCount corresponds to the number of application workers that will perform the parallel ListVectors operation. For example, if you want to use four application threads to list vectors in a vector index, specify a segmentCount value of 4.

If you specify a segmentCount value of 1, the ListVectors operation will be sequential rather than parallel.

If you specify segmentCount, you must also specify segmentIndex.

iv_segmentindex TYPE /AWS1/S3VLISTVECTORSSEGMENTIDX /AWS1/S3VLISTVECTORSSEGMENTIDX

For a parallel ListVectors request, segmentIndex is the index of the segment from which to list vectors in the current request. It identifies an individual segment to be listed by an application worker.

Segment IDs are zero-based, so the first segment is always 0. For example, if you want to use four application threads to list vectors in a vector index, then the first thread specifies a segmentIndex value of 0, the second thread specifies 1, and so on.

The value of segmentIndex must be less than the value provided for segmentCount.

If you provide segmentIndex, you must also provide segmentCount.

iv_returndata TYPE /AWS1/S3VBOOLEAN /AWS1/S3VBOOLEAN

If true, the vector data of each vector will be included in the response. The default value is false.

iv_returnmetadata TYPE /AWS1/S3VBOOLEAN /AWS1/S3VBOOLEAN

If true, the metadata associated with each vector will be included in the response. The default value is false.

RETURNING

oo_output TYPE REF TO /aws1/cl_s3vlistvectorsoutput /AWS1/CL_S3VLISTVECTORSOUTPUT

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_s3v~listvectors(
  iv_indexarn = |string|
  iv_indexname = |string|
  iv_maxresults = 123
  iv_nexttoken = |string|
  iv_returndata = ABAP_TRUE
  iv_returnmetadata = ABAP_TRUE
  iv_segmentcount = 123
  iv_segmentindex = 123
  iv_vectorbucketname = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_listvectorsnexttoken = lo_result->get_nexttoken( ).
  LOOP AT lo_result->get_vectors( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_vectorkey = lo_row_1->get_key( ).
      lo_vectordata = lo_row_1->get_data( ).
      IF lo_vectordata IS NOT INITIAL.
        LOOP AT lo_vectordata->get_float32( ) into lo_row_2.
          lo_row_3 = lo_row_2.
          IF lo_row_3 IS NOT INITIAL.
            lv_float = lo_row_3->get_value( ).
          ENDIF.
        ENDLOOP.
      ENDIF.
      lo_value = lo_row_1->get_metadata( ).
      IF lo_value IS NOT INITIAL.
      ENDIF.
    ENDIF.
  ENDLOOP.
ENDIF.