How calculate trend in data table visualization

Hello,

I'm executing thousands of tests on hourly basis in a CICD pipeline. Each Elasticsearch document is describing a test with fields (name, success, duration, etc).

I'm trying to figure out, how to calculate a trend of failing tests in a data table visualisation, so basically number of successive failed tests.

Example 1: test1.success field values over time: true, false, true, false, false ,false
Result: 3, because there are 3 recent successive failed tests

Example 1: test1.success field values over time: true, false, true, false, false ,true
Result: 0, because the most recent test was successful

For that I would somehow need to iterate over docs grouped by test.name.

Any idea how to accomplish this?

Hmm, I can't think of a way to get exactly what you want here, but what you could do is calculate the average success rate over that last N number of hits, or for a given time range. Would that be helpful?

There might also be a way to do this in Canvas if you're interested in giving it a try.