Closed supersven closed 1 month ago
To me it looks like the FromJSON EsError
instance does not fit to the response.
instance FromJSON EsError where
parseJSON (Object v) =
EsError
<$> v
.:? "status"
<*> (v .: "error" <|> (v .: "error" >>= (.: "reason")))
parseJSON _ = empty
The implementation expects an error
or error.reason
field, while in the response there's an array (failures
) with reason
s.
Would it make sense to adjust the FromJSON EsError
instance with one more alternative to match the response's structure?
Actually, at this point, ElasticSearch and OpenSearch are starting to diverge so much, I'm considering have their error types distinct.
diverge
@blackheaven Thanks a lot for looking into this!
I agree that in future separate types may make sense; especially, because the OpenSearch response carries more information than EsError
.
However, I've created a quick-fix in https://github.com/bitemyapp/bloodhound/pull/301 . It adjusts the FromJSON
instance to map some information into an EsError
.
Bloodhound version: 76a27a44223e8c24ec2c6a13504ea671887f2672 OpenSearch version: 1.3.19
Error: