Add basic authentication support to the Elasticsearch check.

Useful for anyone using a 3rd party plugin or a service like found.no which has basic auth on by default.

Also:
* Refactors the Elasticsearch check some. I think there's still more to do - the closure/mapping stuff is hard to follow.
* Move all the basic authorization handling into one place because there was a bug in how we were generating the authorization string and it's better to have this stuff in one place (until we have our own Python and can use requests...)