Changes related to bug in elasticsearch count api