ES instance query script