elasticsearch.js switch fixes