Essql can't find the FIRST or LAST functions in canvas

I've been trying to represent a status based on elapsed time since the last e-mail update I received from one of two robots. I'm doing this using an image which changes its source asset based on an essql query.

Currently struggling to assemble an essql query that gives my answer which should be the difference in hours from now to the last update.

SELECT robot, LAST(timestamp)
FROM emails_robos
WHERE nome_cliente = 'AAA' OR
nome_cliente = 'BBB'
GROUP BY robot

Now, I'd still have to subtract NOW() from the result (which I found no way to do without casting both to LONG which doesn't seem to give out an accurate result - if you lend me a hand here I opened another toipic for that: Difference between two DATETIMEs in ESSQL in Canvas (No script fields)) and choose the larger of both values returned, but the problem here is that either using that or the FIRST function gives out the following error:

[essql] > Unexpected error from Elasticsearch: [verification_exception] Found 1 problem(s) line 1:15: Unknown function [LAST], did you mean any of [LEAST, CAST, LCASE, LEFT]?

Anyone stumbled upon this before? Thanks in advance =)

@ebalmeida what Elasticsearch version are you testing this against. FIRST and LAST functions have been added in 6.7.0: https://github.com/elastic/elasticsearch/pull/37936.

@Andrei_Stefan. Yeah, that's it. I didn't notice I was working on an outdated instance. Thank you very much!

By the way, I figured that my problem casting the timestamp to long was because it casts in seconds, and not miliseconds as I expected. Once I figured that out it all made sense.

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