JSONata queries not working while creating Alert Rule

I am using Inifinity plugin with Backend as the parser, in the dashboard panel I am using some query and it is working fine, the same query I am trying to use while creating alerts is not working and giving below error:

Can anyone please suggest what I am doing wrong.

Please note I am using getting data from elasticsearch index in Infinity data source.

Thanks!
Lakshay

https://grafana.github.io/grafana-infinity-datasource/docs/limitations

Actually I have converted my query from uql to Jsonata which backend parser support but the problem is the same query is not working too in Alerts

And you have atest version of infinity?

Please share your query result or the query itself minus sensitive data

@yosiasz you can take this query as a reference, this works fine in panel query but fails in alert

(hits.hits._source).{'createdDate': createdDate}

So what is the alert rule?

Also what version are you on if infinity

Let me explain you my requirement first, in my grafana dashboard infinity panel I wanted a new dynamic field “Delay Hours” which I created with Jsonata query using parser as ‘Backend’ and it works fine,

Panel query looks something like below :

(hits.hits._source).{'orderCreatedDate': orderCreatedDate, 'refundStatus':refundStatus,'returnDeliveryedTime':returnDeliveryedTime,,'delayHours':($millis()-$toMillis($replace(returnDeliveryedTime, ' ', 'T'))) / 3600000 and so on}

Also I need to create an Alert, but the issue is I need to use the “refundStatus” and ‘delayHours’ as a filter conditions but since ‘delayHours’ is calculated dynamically in the panel and it is not present in the elasticsearch index I need to do replicate same query first for the Alert Rule creation since there is no delayHours in elasticsearch, so I am using the same query again

(hits.hits._source).{'orderCreatedDate': orderCreatedDate, 'refundStatus':refundStatus,'returnDeliveryedTime':returnDeliveryedTime,,'delayHours':($millis()-$toMillis($replace(returnDeliveryedTime, ' ', 'T'))) / 3600000 and so on}

but the problem is the above query is failing firstly.

Infinity v 2.3.0

1 Like

I’ve run into the same issue.

Do I understand the limitations documentation correctly that for alerting I can only use the “backend” parser which seems to support only JSONPath?

Otherwise UQL would be a way to go using something like

parse_json | jsonata "<jsonata_expression>"

Edit: Overall I’m a little confused, because the Rows/Root placeholder text says “JSONata / rows selector” and in the backend parser documentation I read that the rows selector is gjson