I am performing Elasticsearch operations in Python. I have following fields and data in Elasticsearch index -
sid member_id timestamp
1 1 2020-11-26T13:10:49.899Z
1 1 2020-11-25T14:10:49.899Z
1 2 2020-11-24T15:10:49.899Z
1 2 2020-11-25T16:10:49.899Z
Following is the mapping on these fields -
"sid": {
"type": "integer",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"member_id": {
"type": "integer",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"timestamp": {
"type": "date",
"format": "yyyyMMdd'T'HHmmss.SSSZ"
}
As a result, I want distinct member_id with latest timestamp as following -
member_id timestamp
1 2020-11-26T13:10:49.899Z
2 2020-11-25T16:10:49.899Z
Is it possible in Elasticsearch to get this result? If yes then please tell me how can I do it. Thanks in Advance.