Description
I toyed with the idea of making this an SO post as I think I must be missing something, but at the moment it seems like an issue.
In the migration guide it is stated
- methods that might have thrown a org.elasticsearch.ElasticsearchStatusException now will throw org.springframework.data.elasticsearch.RestStatusException instead.
No problem, and I understand the rational behind moving to this model, but I seem to be losing detail on the error exceptions.
i.e ElasticSearch 7.15.0 with Spring ES 4.3.0 sends a failing query
ES reponds with it's standard error response
{
"error" : {
"root_cause" : [
{
"type" : "query_shard_exception",
"reason" : "No mapping found for [startEpoch] in order to sort on",
"index_uuid" : "fI1gFUc3T767kR4dq2zz3g",
"index" : "dev_audit_record"
}
],
"type" : "search_phase_execution_exception",
"reason" : "all shards failed",
"phase" : "can_match",
"grouped" : true,
"failed_shards" : [
{
"shard" : 0,
"index" : "dev_audit_record",
"node" : "dtVkRzqhTxitNaJxxf4Wqg",
"reason" : {
"type" : "query_shard_exception",
"reason" : "No mapping found for [startEpoch] in order to sort on",
"index_uuid" : "fI1gFUc3T767kR4dq2zz3g",
"index" : "dev_audit_record"
}
}
]
},
"status" : 400
}
but the RestStatusException
that is surfaced seems to only contain the message "Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]"
The good detail i.e. the bit "No mapping found for [startEpoch] in order to sort on"
is not retrievable from RestStatusException
infact anything other that type
and reason
appears to have been lost.
Should the original client specific exception, (ElasticsearchStatusException
in my case) have been appended to RestStatusException
as the cause?