type Metadata = { title: string; genre: "sci-fi" | "fantasy" | "horror" | "action";};const responseRange = await index.range<Metadata>({ cursor: 0, limit: 2, includeMetadata: true,});if (responseRange[0].metadata) { // Since we passed the Metadata type parameter above, // we can interact with metadata fields without having to // do any typecasting. const { title, genre } = results[0].metadata; console.log(`The best match in fantasy was ${title}`);}
Commands
Range
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 range command is stateless, meaning you need to pass all of the parameters
in each subsequent request.
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.
type Metadata = { title: string; genre: "sci-fi" | "fantasy" | "horror" | "action";};const responseRange = await index.range<Metadata>({ cursor: 0, limit: 2, includeMetadata: true,});if (responseRange[0].metadata) { // Since we passed the Metadata type parameter above, // we can interact with metadata fields without having to // do any typecasting. const { title, genre } = results[0].metadata; console.log(`The best match in fantasy was ${title}`);}