I'm trying to get a max and min value of a date.
From the documentation I don't see a max option in composite: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-composite-aggregation.html#_value_sources
I'd like something like this:
{
"size":0,
"aggs":{
"intervals":{
"composite":{
"size":10000,
"sources":[
{
"id":{
"terms":{
"field":"id"
}
}
},
{
"minTime": {
"min": {
"script": "doc['createdAt'].value"
}
}
},
{
"maxTime": {
"max": {
"script": "doc['createdAt'].value"
}
}
}
]
}
}
}
}
Is it possible to add to this query or will I need a separate query for this?