Timelion throws error while querying on empty data

I am trying to calculate total x value divided by total y value in percentage.

.es(q="*",metric=sum:x.value,split=element.name:10).cusum().divide(.es(q="*",metric=sum:y.value, split=element.name:10).cusum()).multiply(multiplier=100).label(regex='.* element.name:(.*) > .*', label='$1')

But i get this error while selected timerange has no data:

[timelion_vis] > Timelion request error: Error: in cell #1: Cannot read property 'data' of undefined Error: in cell #1: Cannot read property 'data' of undefined

By try and error I manged to find out that removing one of split statement in any query removes error but then I get incorrect results.
How can I remove this error and still get correct data?

Hi Castor, there had been some similar timelion issues erroring undefined with the special case of no data, eg. with the fit function which got fixed since. Please consider a workaround for filling in data analogously to the tip in this gh issue, and please file an issue in the Kibana repo as it looks like a bug.

On the offchance you're a developer, or work with one who can check out the Kibana repo, it'd be appreciated if you could triage the issue and if unhandled empty set is the culprit, consider submitting a PR. For example, the fix for fit turned out to be a five-liner change plus some tests. If you do so, please mention your github issue and/or PR link here in this discussion.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.