I’m currently working on a project using the Google Gemini File Search API.
While most functions—such as creating stores, uploading documents, and generating RAG-based answers—work smoothly, I’n encountering significant performance issues and errors when managing a large volume of indexed documents (over 1,000 files).
I would like to seek advice on the following two issues:
1. Performance bottleneck in locating and deleting specific files The current API doesn’t seem to support filtering the document list by ID or filename within a File Search Store. To delete a specific file, I have to fetch the entire paginated list and iterate through it, which is extremely slow when the store contains many documents. Is there a more efficient way to target and delete a single file without listing everything?
2. 503 Service Unavailable error when deleting a File Search Store When I try to delete an entire File Search Store that contains a large number of documents, the API often returns a 503 Service Unavailable error. This happens even when I set the force parameter to true. It appears the system is struggling to handle the bulk deletion of the embedded data.
While I could manually implement a batch deletion process for every document in the store, I’m hoping for a more inherently efficient method or a specific API capability designed for large-scale cleanup
Error Log:
INFO:httpx:HTTP Request: DELETE https://generativelanguage.googleapis.com/v1beta/fileSearchStores/[STORE_ID]?force=True "HTTP/1.1 503 Service Unavailable"
ERROR:app.services.gemini_service:Error deleting file search store: 503 UNAVAILABLE.
{'error': {'code': 503, 'message': 'The service is currently unavailable.', 'status': 'UNAVAILABLE'}}
Questions:
-
Are there any best practices for managing or deleting specific files in a large-scale File Search Store?
-
How can I reliably delete a store with many documents without triggering a 503 error? Is there a recommended cleanup procedure for large stores?
I would appreciate any insights or workarounds. Thank you!