lots of changes due to elasticsearch.js