I am trying to write a query which will return first entry of every month but I am not able to find anything can any one please help me with it .
i tried the below query but it return number of documents in that month not the first document in that month
{
"query" : {
"term" : { "id" : "1" }
},"size":0,
"aggs" : {
"sales_over_time" : {
"date_histogram" : {
"field" : "date",
"interval" : "month"
}
}
}
}