Hi guys.
I am trying to get all the record having the latest created time so I come up with this query:
{
"query": {
"term": {
"username": "xxx"
}
},
"aggs": {
"sessions": {
"terms" : { "field" : "id", "size": 1000 },
"aggs": {
"created_time": {
"min": {
"field": "created_time"
}
}
}
}
}
}
But the hit array still return two records with different created time, only the aggs section return the latest created time records.
Is there any way to filter the hits with created time? Because I need to get all the fields in hit array missing in aggregation array.