Skip to content

Commit

Permalink
Log errors reported in responses from esapi.Search (#809)
Browse files Browse the repository at this point in the history
  • Loading branch information
efd6 authored May 5, 2022
1 parent 7d07a58 commit 26e638a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion internal/testrunner/runners/system/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,24 @@ func (r *runner) getDocs(dataStream string) ([]common.MapStr, error) {
Source common.MapStr `json:"_source"`
}
}
Error *struct {
Type string
Reason string
}
Status int
}

if err := json.NewDecoder(resp.Body).Decode(&results); err != nil {
return nil, errors.Wrap(err, "could not decode search results response")
}

numHits := results.Hits.Total.Value
logger.Debugf("found %d hits in %s data stream", numHits, dataStream)
if results.Error != nil {
logger.Debugf("found %d hits in %s data stream: %s: %s Status=%d",
numHits, dataStream, results.Error.Type, results.Error.Reason, results.Status)
} else {
logger.Debugf("found %d hits in %s data stream", numHits, dataStream)
}

var docs []common.MapStr
for _, hit := range results.Hits.Hits {
Expand Down

0 comments on commit 26e638a

Please sign in to comment.