Commands
Range
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
cursorbodystringrequired
The cursor to the last retrieved document. Should be set to 0 in the initial range request.
prefixbodystring
A string prefix to match document IDs. All documents with IDs that start with this prefix will be retrieved.
limitbodynumberrequired
The number of maximum documents wanted in the response of range. (page size)
Response
RangeResponseObjectrequired
Basic
const responseRange = await index.range({ cursor: "0", limit: 2,});/*{ nextCursor: '2', documents: [ { id: "doc1", content: { ... }, metadata: { ... } }, { id: "doc2", content: { ... }, metadata: { ... } } ]}*/ID prefix
const responseRange = await index.range({ cursor: "0", limit: 2, prefix: "test-",});/*{ nextCursor: '2', documents: [ { id: "test-1", content: { ... }, metadata: { ... } }, { id: "test-2", content: { ... }, metadata: { ... } } ]}*/