es: add support for Elasticsearch 1.0.

Here's a small attempt to bring compatibility to 1.0. This is untested code.