Hi,
My question is that I need to find the first time login of each user, and then apply date_histogram aggregation. I tried top_hits aggregation, min aggregation and collapse. They all get the first time login of each user, but I don't know how to apply histogram aggregation on the top_hit or min aggregation result. And for collapse, the doc says "The collapsing is applied to the top hits only and does not affect aggregations." Is there a way to do it?
Thank you so much.
Example data:
{
"_id" : "d78f4a88",
"@timestamp" : "2019-08-23T20:03:13.297608",
"eventType" : "login",
"userId" : "9784a0008cf2"
},
{
"_id" : "78852d56",
"@timestamp" : "2019-08-27T18:13:58.963763",
"eventType" : "login",
"userId" : "9784a0008cf2"
},
{
"_id" : "6a7b9406",
"@timestamp" : "2019-08-28T03:47:04.704077",
"eventType" : "login",
"userId" : "3b3be93b0751"
},
{
"_id" : "23490d4",
"@timestamp" : "2019-08-28T23:54:23.704586",
"eventType" : "login",
"userId" : "3b3be93b0751"
}
Thanks.