Through an Elastic SQL query, how can I retrieve data belonging to today only?
I've tried:
select "@timestamp", today(), now(),
TimeOfLastReceivedUpdate
FROM "index*"
where
Name = 'value'
and
("@timestamp" >= today() AND "@timestamp" <= NOW())
We're based in Australia.
And today() and now() return
2020-06-04T10:00:00+10:00 and 2020-06-05T09:48:09+10:00
now is correct, today is yesterdays date.
So what would I put in my where clause to get data of today only? TimeOfLastReceivedUpdate is our own field, @timestamp is the ES field.
POST /_sql?format=txt
{
"query" : "select \"@timestamp\", today(), now(), TimeOfLastReceivedUpdate FROM \"index*\" where Name = 'value' and (\"@timestamp\" >= today() AND \"@timestamp\" <= NOW())",
"time_zone": "Australia/Sydney"
}
select "@timestamp", today(), now(),
TimeOfLastReceivedUpdate
FROM "index*"
where
Name = 'value'
and
("@timestamp" >= today() AND "@timestamp" <= NOW())
In the above query, just running the SQL, without the API as you have done, how can I specify the timezone is my question.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.