ENG-5393: Fix elastic index related bugs