I have the "action" field, I want to query last 15 minutes
and get the avg 'transactions' for every action type every (interval) seconds.
I made this but it gives me just the last minute result
body: {
size: 0,
query: {
bool: {
must: [
{
range: {
'@timestamp': {
gte: from,
lt: to,
}
}
}
]
}
},
aggs:{
{
agg1: {
date_histogram: {
field: '@timestamp',
interval: '5s',
aggs:{
sub_agg1: {
terms: {
field: "action",
aggs: {
stats_aggregation: {
stats: {
field: "avg"
}
}
}
},
}
}
}
}
}
}
}