typesense / typesense-js

JavaScript / TypeScript client for Typesense
https://typesense.org/docs/api
Apache License 2.0
414 stars 75 forks source link

[Feature request] retrieve multiple documents by id at once #231

Closed EmilyYond closed 1 month ago

EmilyYond commented 1 month ago

Currently you can only retrieve one document at a time using https://typesense.org/docs/27.0/api/documents.html#retrieve-a-document. We have several instances where we need to retrieve multiple documents at once by their id, so currently we have to use a for loop to get them one at a time which is unnecessary overhead.

Please could you add something like client.collections('companies').documents(['123', '456', '789']).retrieve() that would get back the 3 documents in question?

Thanks 😄

jasonbosco commented 1 month ago

Here's how to do this using the search endpoint and filter_by: https://threads.typesense.org/2K5cf6

EmilyYond commented 1 month ago

Ahhhh thank you!