Queries involving dates don't seem to work?

Hi! I hope all is well.

While testing of the management API, I’m having trouble getting my date-related queries to work.

I’m getting the management token OK, and queries not involving dates work just fine (i.e. “name”, “email”, “logins_count”, etc.).

However, I can’t get queries involving “last_login” or "created_at "to return anything. Running queries involving these fields returns a Response Code of 200, but the Response Body is always ‘’ (which is incorrect since they should have entries).

Here are the q parameters that I’m testing:

created_at:{2022-08-18 TO 2021-01-01]
last_login:[* TO 2021-01-01]

As well as a full sample query:

Also, what is the correct way to specify a range of dates relative to today (for example, the past 24 hours, or the past week)? The elastic search method that was recommended (i.e. “now-1d/d”) does not seem to be recognized by the API.

Many Thanks and hope to hear back from you soon,

Rob

Hi @robliou01 ,

I understand that you want to search by the date time field with a range. I tested with the below q parameters and got the result.

last_login: [“2022-08-16T17:44:50.968Z” TO “2022-08-20T17:44:50.968Z”]
last_login: “2022-08-16T17:44:50.968Z”

Hope it works for your use case!

Excellent, thank you Lihua!

I had the dates in descending order, which was causing the problem.

Thanks again,

Rob

You are very welcome! :handshake: