Improved changes made in 9c8799f, allowing to pass kwargs to ES when using generate_model