Using inner_hits inside an aggregation

I have a collection of documents which all contain an array of nested objects with important data. I want do to an aggregation on these which returns me the first document, last document, and all of the nested objects in that group. I can achieve everything in that list except for the nested objects.

Mapping:

"instances": {
   "properties": {
       "aggField": {
          "type": "string",
          "index": "not_analyzed"
       },
       "id": {
          "type": "integer"
       },
       "nestedObjs": {
          "type": "nested",
          "properties": {
             "key": {
                "type": "string",
                "index": "not_analyzed"
             },
             "value": {
                "type": "integer"
             }
          }
       },
       "timestamp": {
          "type": "date",
          "format": "dateOptionalTime"
       }
   }
}

Query:

{
"size" : 0,
"aggs" : {
    "agg-buckets" : {
        "terms" : {
            "field" : "aggField",
            "size" : 10
        },
        "aggs": {
            "last-report": {
                "top_hits": {
                    "sort": [
                        {
                            "timestamp": {
                                "order": "desc"
                            }
                        }
                    ],
                    "size": 1
                }
            },
            "first-report": {
                "top_hits": {
                    "sort": [
                        {
                            "timestamp": {
                                "order": "asc"
                            }
                        }
                    ],
                    "size": 1
                }
            },
            "nested-objs": {
                "nested": {
                    "path": "nestedObjs",
                    "inner_hits": {}
                }
            }
        }
    }
}

But this fails with:

   "error": {
      "root_cause": [
         {
            "type": "search_parse_exception",
            "reason": "Unexpected token START_OBJECT in [nested-objs].",
            "line": 12,
            "col": 45
         }
      ],

If I remove the "inner_hits" field it works ok. But it just gives me the document count and not the documents themselves.

What am I doing wrong?

I have tried this on ES 1.7.1 and 2.0.0

Anyone? :frowning: