@@ -1372,6 +1372,7 @@ async def get_document(
13721372 async def get_documents (
13731373 self ,
13741374 * ,
1375+ ids : list [str ] | None = None ,
13751376 offset : int = 0 ,
13761377 limit : int = 20 ,
13771378 fields : list [str ] | None = None ,
@@ -1382,6 +1383,7 @@ async def get_documents(
13821383 """Get a batch documents from the index.
13831384
13841385 Args:
1386+ ids: Array of document primary keys to retrieve. Defults to None (Gets all documents).
13851387 offset: Number of documents to skip. Defaults to 0.
13861388 limit: Maximum number of documents returnedd. Defaults to 20.
13871389 fields: Document attributes to show. If this value is None then all
@@ -1418,7 +1420,7 @@ async def get_documents(
14181420 if retrieve_vectors :
14191421 parameters ["retrieveVectors" ] = "true"
14201422
1421- if not filter :
1423+ if not filter and not ids :
14221424 if fields :
14231425 parameters ["fields" ] = "," .join (fields )
14241426
@@ -1432,6 +1434,9 @@ async def get_documents(
14321434
14331435 parameters ["filter" ] = filter
14341436
1437+ if ids :
1438+ parameters ["ids" ] = ids
1439+
14351440 response = await self ._http_requests .post (f"{ self ._documents_url } /fetch" , body = parameters )
14361441
14371442 return DocumentsInfo (** response .json ())
@@ -5640,6 +5645,7 @@ def get_document(
56405645 def get_documents (
56415646 self ,
56425647 * ,
5648+ ids : list [str ] | None = None ,
56435649 offset : int = 0 ,
56445650 limit : int = 20 ,
56455651 fields : list [str ] | None = None ,
@@ -5650,6 +5656,7 @@ def get_documents(
56505656 """Get a batch documents from the index.
56515657
56525658 Args:
5659+ ids: Array of document primary keys to retrieve. Defults to None (Gets all documents).
56535660 offset: Number of documents to skip. Defaults to 0.
56545661 limit: Maximum number of documents returnedd. Defaults to 20.
56555662 fields: Document attributes to show. If this value is None then all
@@ -5686,7 +5693,7 @@ def get_documents(
56865693 if retrieve_vectors :
56875694 parameters ["retrieveVectors" ] = "true"
56885695
5689- if not filter :
5696+ if not filter and not ids :
56905697 if fields :
56915698 parameters ["fields" ] = "," .join (fields )
56925699
@@ -5700,6 +5707,9 @@ def get_documents(
57005707
57015708 parameters ["filter" ] = filter
57025709
5710+ if ids :
5711+ parameters ["ids" ] = ids
5712+
57035713 response = self ._http_requests .post (f"{ self ._documents_url } /fetch" , body = parameters )
57045714
57055715 return DocumentsInfo (** response .json ())
0 commit comments