Elasticsearch 1.0 prep

These are changes that prepare us for Elasticsearch 1.0 and also work on < 1.0.