Canvas -Display Time diff

Hi,

I read Difference between two DATETIMEs in ESSQL in Canvas (No script fields) that TIMESTAMPDIFF is not yet available for elasticsearch sql. I am wondering if there is another way to present time difference in my Canvas with datasource based on Elasticsearch query.

I have the same row with startTime and endTime. I would like to present overall time (endTime - startTime). Is it possible to make it:

  1. directly in elasticsearch sql without using TIMESTAMPDIFF
  2. using some function inside the Expression Editor in Canvas

Any ideas?

Regards,
Cesar Lino

@Catherine_Liu is there a way out to achieve this? TIMESTAMPADD and TIMESTAMPDIFF it's on our TODO list: https://github.com/elastic/elasticsearch/issues/37927

Thanks
Rashmi

Hi @rashmi, thank you for your reply. I saw these functions are still pending but it is not clear when they will come... Any date planned? My idea about this post was to find out other way to deal with this requirement before having these functions available. I would appreciate if @Catherine_Liu or anybody else could point out an alternative way...

Regards,
Cesar Lino

Hi,

I was able to do that converting to millis and calculating them using math on mapColumn and converting back to Date:

mapColumn name="overallTime" fn={math "subtract(ingestEndMillis,ingestStartMillis)"}

Thanks,
Cesar Lino

1 Like