const responseRange = await index.range({
  cursor: "0",
  limit: 2,
});

/*
{
  nextCursor: '2',
  documents: [
    { id: "doc1", content: { ... }, metadata: { ... } },
    { id: "doc2", content: { ... }, metadata: { ... } }
  ]
}
*/

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

The range command is stateless, meaning you need to pass all of the parameters in each subsequent request.

Arguments

cursor
string
required

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

prefix
string

A string prefix to match document IDs. All documents with IDs that start with this prefix will be retrieved.

limit
number
required

The number of maximum documents wanted in the response of range. (page size)

Response

RangeResponse
Object
required
const responseRange = await index.range({
  cursor: "0",
  limit: 2,
});

/*
{
  nextCursor: '2',
  documents: [
    { id: "doc1", content: { ... }, metadata: { ... } },
    { id: "doc2", content: { ... }, metadata: { ... } }
  ]
}
*/