const responseRange = await index.range({
  cursor: 0,
  limit: 2,
  includeMetadata: true,
});
/*
{
  nextCursor: '2',
  vectors: [
    { 
      id: '0',
      metadata: {
        keyword: "Vector"
      } 
    },
    { 
      id: '19',
      metadata: {
        keyword: "Redis"
      } 
    }
  ]
}
*/

The range method is used to retrieve vectors in chunks with pagination. This method supports a variety of options to configure the query to your needs.

The dimension of the query vector must match the dimension of your index.

Arguments

cursor
string | number
required

The cursor to the last retrieved vector. Should be set to 0 in the initial range.

limit
number
required

The number of maximum vectors tha want in the response of range. (page size)

includeMetadata
boolean

Whether to include the metadata of the vectors in the response. Setting this true would be the best practice, since it will make it easier to identify the vectors.

includeVectors
boolean

The metadata of the vector. This is used to make it easier to identify the vector on queries.

Response

RangeResponse
required
nextCursor
string | number
required

The ID of the resulting vector. Empty if there are no other vectors in the index.

vectors
Vector | Vector[]
required
id
string | number
required

The ID of the vector

vector
number[]
required

The embedding data

metadata
Record<string, unknown>

The metadata of the vector. This is used to make it easier to identify the vector on queries.