refactor es related methods to es_wrapper