# How can I pass a JSON aggregation string to a AggregatoinBuilder

**URL:** https://discuss.elastic.co/t/how-can-i-pass-a-json-aggregation-string-to-a-aggregatoinbuilder/64797
**Category:** Elasticsearch
**Created:** [November 3, 2016, 5:13am UTC](https://discuss.elastic.co/t/how-can-i-pass-a-json-aggregation-string-to-a-aggregatoinbuilder/64797 "2016-11-03T05:13:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![yanming12345](https://avatars.discourse-cdn.com/v4/letter/y/3e96dc/32.png) [@yanming12345](https://discuss.elastic.co/u/yanming12345)
#### Post date: [November 3, 2016, 5:13am UTC](https://discuss.elastic.co/t/how-can-i-pass-a-json-aggregation-string-to-a-aggregatoinbuilder/64797/1 "2016-11-03T05:13:23Z")

</div>

I have been trying for hours to get this working. Basically I have a class  
that performs a aggregation and I want the user to be able to pass a  
JSON aggregatoin string to my constructor and then use that on the aggregation  
to further reduce the results. I have tried all manner of AggregationBuilders  
methods and SearchRequestBuilder methods.

---

<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: [July 5, 2017, 10:07pm UTC](https://discuss.elastic.co/t/how-can-i-pass-a-json-aggregation-string-to-a-aggregatoinbuilder/64797/2 "2017-07-05T22:07:04Z")

</div>


