ElasticSearch - Latest record per day per ID from elastic

I have index in Elsaticsearch of records of form:

Record{
  Timestamp;
  Id;
  .
  .}

It has multiple records for ID per day.

I want to fetch latest record per Id per day. Can you please help me with such query?

Example- Records :

R1 -> Id=A1, Timestamp = 2021-02-02_12:00:00, other fields
R2 -> Id=A1, Timestamp = 2021-02-02_11:00:00, other fields
R3 -> Id=A2, Timestamp = 2021-02-02_10:30:00, other fields
R4 -> Id=A2, Timestamp = 2021-02-02_10:00:00, other fields
R5 -> Id=A1, Timestamp = 2021-02-01_13:00:00, other fields
R6 -> Id=A1, Timestamp = 2021-02-01_11:00:00, other fields
R7 -> Id=A2, Timestamp = 2021-02-01_11:30:00, other fields
R8 -> Id=A2, Timestamp = 2021-02-01_10:00:00, other fields

Required output: Complete records : R1, R3, R5, R7

Hi Prashant.
See this post

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