private static Aggregation parseBuckets(JsonParser parser, String name, ArrayNode nodes)
            throws JsonProcessingException {

      List<Bucket> buckets = new ArrayList<>(nodes.size());
      for (JsonNode b: nodes) {
        buckets.add(parseBucket(parser, name, (ObjectNode) b));
      }

      return new MultiBucketsAggregation(name, buckets);
    }
Allows to de-serialize nested aggregation structures.
criteria/elasticsearch/src/org/immutables/criteria/elasticsearch/Json.java