Commands

Fetch

Used to retrieve documents by their IDs.

Arguments

IDsstring[] | number[]required

The IDs of the documents you want to fetch.

OR

FetchPayloadobjectrequired

Response

FetchResult[]Document[]required

This field is null if no document with the specified ID is found.

Basic
await index.fetch({ ids: ["star-wars", "inception"] });/*[  {    id: "star-wars",    content: { ... },    metadata: { ... }  },  {    id: "inception",    content: { ... },    metadata: { ... }  }]*/
ID prefix
await index.fetch({ prefix: "star-" });/*[  {    id: "star-wars"    content: { ... },    metadata: { ... }  },  {    id: "star-trek",    content: { ... },    metadata: { ... }  }]*/
Loading search…