# rollupSearch with new Java Api Client

**URL:** <https://discuss.elastic.co/t/rollupsearch-with-new-java-api-client/295736>\
**Category:** Elasticsearch\
**Created:** [January 29, 2022, 12:32am UTC](https://discuss.elastic.co/t/rollupsearch-with-new-java-api-client/295736 "2022-01-29T00:32:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfox](https://avatars.discourse-cdn.com/v4/letter/r/b4bc9f/32.png) [@rfox](https://discuss.elastic.co/u/rfox)\
**Post date:** [January 29, 2022, 12:32am UTC](https://discuss.elastic.co/t/rollupsearch-with-new-java-api-client/295736/1 "2022-01-29T00:32:45Z")

</div>

I am struggling to use the new rollupSearch API.  
I am trying to map this query:

```auto
GET count_rollup/_rollup_search
{
  "size": 0,
  "aggregations": {
    "timeline": {
      "date_histogram": {
        "field": "datetime",
        "calendar_interval": "1d"
      },
      "aggs" : {
        "parent_name" : {
          "terms": {
            "field": "first_name.keyword",
            "include": "bob"
          },
          "aggs": {
            "lastname_count" : {
              "terms" : {
                "field" : "last_name.keyword"
              }
            }
          }
        }
      }
    }
  }
}

```

In just trying to get the first level aggregation done:

```auto
            RollupSearchResponse<Object> results = elasticsearchClient.rollup().rollupSearch(_0 -> _0
                            .index(elasticSearchConfigBean.indexName())
                            .aggregations(""parent_name", _3 -> _3
                                    .terms(_4 -> _4
                                            .field("first_name.keyword")
                                    )
                            )
                            .size(0),
                    Object.class);

```

I get the following exception: `Property name 'parent_name' is not in the 'type#name' format. Make sure the request has 'typed_keys' set`

Also can't figure out how to apply the "include".

Any tips or pointers to an example is greatly appreciated.

Thanks,

Randy

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 26, 2022, 12:32am UTC](https://discuss.elastic.co/t/rollupsearch-with-new-java-api-client/295736/2 "2022-02-26T00:32:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
