# Range Aggregation using problem with Java API\[5.0\]

**URL:** <https://discuss.elastic.co/t/range-aggregation-using-problem-with-java-api-5-0/68319>\
**Category:** Elasticsearch\
**Created:** [December 7, 2016, 3:32pm UTC](https://discuss.elastic.co/t/range-aggregation-using-problem-with-java-api-5-0/68319 "2016-12-07T15:32:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![girish\_pathak](https://avatars.discourse-cdn.com/v4/letter/g/e9bcb4/32.png) [@girish\_pathak](https://discuss.elastic.co/u/girish_pathak)\
**Post date:** [December 7, 2016, 3:32pm UTC](https://discuss.elastic.co/t/range-aggregation-using-problem-with-java-api-5-0/68319/1 "2016-12-07T15:32:22Z")

</div>

Hi,  
I am using Range Aggregation with Java API [5.0] and following the documentations in below link.  
[https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/\_bucket\_aggregations.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/_bucket_aggregations.html)  
And executing the following code :

`System.out.println(" ---range agg--- "+AggregationBuilders.range("agg").field("height").addUnboundedTo(1.0f).addRange(1.0f, 1.5f).addUnboundedFrom(1.5f));`

And getting `{ "error" : "JsonGenerationException[Can not write a field name, expecting a value]"}` can anyone help me here please where i am doing wrong.

---

<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:** [January 4, 2017, 3:32pm UTC](https://discuss.elastic.co/t/range-aggregation-using-problem-with-java-api-5-0/68319/2 "2017-01-04T15:32:37Z")

</div>

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