error handling on elasticsearch request