improve elastic search function