{
    "size": 0,
    "query": { "match_all": [] },
    "aggs": {
        "datestats": {
            "nested": {
                "path": "creation_years"
            },
            "aggs": {
                "years": {
                    "terms": {
                        "field": "creation_years.year",
                        "size": 0,
                        "order": {
                            "_term": "asc"
                        }
                    },
                    "aggs": {
                        "year_count": {
                            "sum": {
                                "field": "creation_years.weight"
                            }
                        }
                    }
                }
            }
        }
    }
}
