Skip to content

Commit 26e638a

Browse files
authored
Log errors reported in responses from esapi.Search (#809)
1 parent 7d07a58 commit 26e638a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

internal/testrunner/runners/system/runner.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,24 @@ func (r *runner) getDocs(dataStream string) ([]common.MapStr, error) {
246246
Source common.MapStr `json:"_source"`
247247
}
248248
}
249+
Error *struct {
250+
Type string
251+
Reason string
252+
}
253+
Status int
249254
}
250255

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

255260
numHits := results.Hits.Total.Value
256-
logger.Debugf("found %d hits in %s data stream", numHits, dataStream)
261+
if results.Error != nil {
262+
logger.Debugf("found %d hits in %s data stream: %s: %s Status=%d",
263+
numHits, dataStream, results.Error.Type, results.Error.Reason, results.Status)
264+
} else {
265+
logger.Debugf("found %d hits in %s data stream", numHits, dataStream)
266+
}
257267

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

0 commit comments

Comments
 (0)