Is there a way to setup a callback following an Elasticsearch query in Python so that I know that a retry has occurred?
I am using the elasticsearch package. See elasticsearch-py. I create an Elasticsearch client and run a query like this:
try:
es_client = Elasticsearch(hosts=[my_machine], timeout=600, max_retries=3, retry_on_timeout=True
response = es_client.count(index=index, body=body)
except Exception as e:
print(e)
Assume that index and body are well-formed.
If the 600-second timeout is reached, a retry occurs. However, Elasticsearch does not report that a retry has occurred until all three retries have failed. The except clause is not reached until all three retries have failed.
Is there a way to be notified that a retry has occurred prior to the failure of all retries?