I made changes to support async querying. It turns out the underlying HTTP library does support this (through multiprocessing pool), if you pass async_req=True to query. However, the pinecone library’s Index::query method doesn’t handle the AsyncResult that comes back, as they attempt to parse_query_response assuming it’s actually a response instead of an AsyncResult. So I inherited off of Index and made my own class.
You can see the approach here:
It returns an ‘AsyncHandle’ (wrapper class in the gist), so you can call ‘get’ when you want to wait for the results. I didn’t have an easier way to chain this on short notice.
To use, instantiate AsyncIndex with num_threads to be like 30 or something. Remember you want to keep the index around.