Gave credits to the elasticsearch-py team for providing the connection pool code.