Update elasticsearch.go

This commit is contained in:
Ice3man 2021-09-18 15:59:01 +05:30 committed by GitHub
parent 54214eb400
commit 712e3aeb72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,7 +104,11 @@ func (i *Exporter) Export(event *output.ResultEvent) error {
req.Body = ioutil.NopCloser(bytes.NewReader(b))
res, err := i.elasticsearch.Do(req)
b, _ = ioutil.ReadAll(res.Body)
if err != nil {
return err
}
b, err = ioutil.ReadAll(res.Body)
if err != nil {
return errors.New(err.Error() + "error thrown by elasticsearch " + string(b))
}