I have following code:
def delete(id: String) = {
client.execute {
deleteByQuery("myIndex", termQuery("id", id))
}.await
}
delete(id) match {
case failure: RequestFailure => complete(StatusCodes.InternalServerError, failure.body.getOrElse("Unknown reason"))
case success: RequestSuccess[DeleteByQueryResponse] => {
complete("I want to put info extracted from results here...")
}
I observe that inside success object there is a field by name 'result', and it is of type Left[DeleteByQueryResponse].
RequestSuccess has a map method
final def map[V](f: U => V): Response[V] = RequestSuccess(status, body, headers, f(result))
where U is of same type as 'result'.
I am not really sure how to extract all relevant information from 'result'?