Fix elasticsearch search function