Date Range Not Working with Now

I am trying to show only those documents where published_at date is less than now-7d/d.

#It seems ES is not working correctly here. I tried with an example of showing documents which are having published_at filed greater than current datetime. Even though the published_at field is not greater than now but i still see one document in results. I am not sure what is happening here.

Please also note that then i am using "2021-03-30 20:20:49" instead of "now" then it is working. Something is wrong with now.

Or may be now is not what you think it is.
I mean that may be you did not set a timezone anywhere and now actually represents now UTC based.

Thanks, I tried supplying time_stamp as well but no luck

GET ak_questions/_search { "sort": [ { "created_at": { "order": "desc" } } ], "query": { "bool": { "must": { "range": { "published_at": { "time_zone": "+05:30", "lte": "now" } } } } } }

The above query is not showing me the latest published question even though it is less than current timestamp using now.

Is there a way i can print what timestamp now is returning?

I meant the timezone in the source data not when you are querying.
What does a typical document look like?

I have not specified timezone in fields mapping. Kindly check the attached screenshotScreenshot 2021-03-31 at 2.38.36 PM

I think my Kibana is using default timezone of IST and when querying then it is resolving published_at timestamp to +5:30, because when i specify time_zone in query then the document doesn't match against 2021-03-31 13:57:52 even as it is adding 5:30 hours to published_at.

Please don't post images of text as they are hard to read, may not display correctly for everyone, and are not searchable.

Instead, paste the text and format it with </> icon or pairs of triple backticks (```), and check the preview window to make sure it's properly formatted before posting it. This makes it more likely that your question will receive a useful answer.

It would be great if you could update your post to solve this.

As far as I can see you are not specifying a timezone in your dates in the document. That's why you have incorrect results I think.