Here is an example of a time series:
[
{
"_id": {
"action": "click",
"date": "2015-02-02T00:00:00+01:00"
},
"total": 5
},
{
"_id": {
"action": "hit",
"date": "2015-02-02T00:00:00+01:00"
},
"total": 13
},
{
"_id": {
"action": "hit",
"date": "2015-02-03T00:00:00+01:00"
},
"total": 25
},
{
"_id": {
"action": "click",
"date": "2015-02-03T00:00:00+01:00"
},
"total": 7
}
]
In order to calculate the percentage between clicks and hits for each date, you can return a new object formatted like this:
[
{
"_id": {
"action": "ctr",
"date": "2015-02-02T00:00:00+01:00"
},
"total": 38.46
},
{
"_id": {
"action": "ctr",
"date": "2015-02-03T00:00:00+01:00"
},
"total": 28
}
]
If you need any guidance on how to achieve this calculation, feel free to ask!