Hi,
I am trying to get the last 3 consulted products :
so i need to make an aggregation based on productcode then use the option order .
here is what i am trying to do
{
"size" : 0,
"aggs" : {
    "products" : {
        "terms" : {
          "field" : "productcode",
          "order": {
            "timestamp" : "asc" 
          },
          "size" : 3
        }
    }
}
 }
this won't work for sure, but is there any solution for this problem?? any proposition will be helpful
Thank you!
