Visualize aggs min as sub bucket

Hello all,
I have the below elasticsearch query

GET /monthly-data/_search
{
"size": 0,
"aggs": {
"accname": {
"terms": {
"field": "User.keyword"
},
"aggs": {
"year ": {
"terms": {
"field": "Year.keyword"
},
"aggs" : {
"min_date" : { "min" : { "field" : "@timestamp" } }
}
}
}
}
}
}

How should I put the aggregation result to visualization and the Y-Axis to be cumulative sum?
I wish I could have the cumulative sum overtime for min(@timestamp) group by "user" and "year"

Thank you!

For more info, this is a further question of the following thread
https://discuss.elastic.co/t/how-elasticsearch-query-should-be-written-for-the-following-sql-statement/196288/10

any help pls?

There are a number of details that need to be correct in order to do this - can you share a screenshot of your results so far? I'm uncertain where in the process you're getting stuck.

hello Matthew Kime,
I am Matthew too, but Matthew Mak :smiley:
I think I am quite clear on my question

I wish I could have the cumulative sum overtime for min(@timestamp) group by "user" and "year"

How would you do this in Kibana Visualization (eg Line Chart)?
For example, there is data like:
timestamp, user, study_year
2018-09-01, abc, year_1
2018-09-10, abc, year_1
2018-09-20, abc, year_1
2018-09-25, xyz, year_2
2018-09-29, xyz, year_2

if I doing -----> min(@timestamp) group by "user" and "year"
the data set will be:
timestamp, user, study_year
2018-09-01, abc, year_1
2018-09-25, xyz, year_2

and then I want to plot a Line Chart
Y axis will be the cumulative sum of the student count, X axis will be the time series
How could Kibana do this?

Thank you in advance