I'm looking for an ElasticSearch Python client that can make asynchronous requests. For example, I'd like to write this code,
query1_future = es.search('/foobar', query1_json)
query2_future = es.search('/baz', query2_json) # Submit query 2 right after query 1, don't wait for its response
query1 = query1_future.get()
query2 = query2_future.get()
However, I don't see any clients (PyES, or the official client, for example) supporting this. Further, the two I'm familiar with couple the request logic with the response processing logic, so modifying them myself seems difficult. Perhaps a sufficient interim solution would be to use the asynchronous version of Requests, grequests?
Also, it's worth pointing out that ElasticSearch's _msearch
may be a better-performing option, but for real-world applications it'd require some code restructuring.