# Getting average aggregation in java

**URL:** <https://discuss.elastic.co/t/getting-average-aggregation-in-java/17493>\
**Category:** Elasticsearch\
**Created:** [May 13, 2014, 8:21pm UTC](https://discuss.elastic.co/t/getting-average-aggregation-in-java/17493 "2014-05-13T20:21:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![T\_Vinod\_Gupta](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@T\_Vinod\_Gupta](https://discuss.elastic.co/u/T_Vinod_Gupta)\
**Post date:** [May 13, 2014, 8:21pm UTC](https://discuss.elastic.co/t/getting-average-aggregation-in-java/17493/1 "2014-05-13T20:21:32Z")

</div>

has anyone gotten average aggregation in java? how do you use the api to  
create the aggregation request? it is quite confusing..

i want to do the following in java -  
"aggregations" : { "avg\_grade" : { "avg" : { "field" : "score" }}}

thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHau4yug%3Dep6%3DFs6m8%2B8ME1uv09N9ua%3DZUdsQxWp8TG2\_02k-w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHau4yug%3Dep6%3DFs6m8%2B8ME1uv09N9ua%3DZUdsQxWp8TG2_02k-w%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 13, 2014, 8:32pm UTC](https://discuss.elastic.co/t/getting-average-aggregation-in-java/17493/2 "2014-05-13T20:32:51Z")

</div>

Have a look here [https://github.com/dadoonet/legacy-search/blob/06-compute/src/main/java/fr/pilato/demo/legacysearch/dao/ElasticsearchDao.java#L37](https://github.com/dadoonet/legacy-search/blob/06-compute/src/main/java/fr/pilato/demo/legacysearch/dao/ElasticsearchDao.java#L37)

Should help.

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 13 mai 2014 à 22:21, T Vinod Gupta [tvinod@readypulse.com](mailto:tvinod@readypulse.com) a écrit :

has anyone gotten average aggregation in java? how do you use the api to create the aggregation request? it is quite confusing..

i want to do the following in java -  
"aggregations" : { "avg\_grade" : { "avg" : { "field" : "score" }}}

## thanks

You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHau4yug%3Dep6%3DFs6m8%2B8ME1uv09N9ua%3DZUdsQxWp8TG2\_02k-w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHau4yug%3Dep6%3DFs6m8%2B8ME1uv09N9ua%3DZUdsQxWp8TG2_02k-w%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/D3079468-9639-4526-93BF-16EE195F94C4%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/D3079468-9639-4526-93BF-16EE195F94C4%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![T\_Vinod\_Gupta](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@T\_Vinod\_Gupta](https://discuss.elastic.co/u/T_Vinod_Gupta)\
**Post date:** [May 14, 2014, 8:41am UTC](https://discuss.elastic.co/t/getting-average-aggregation-in-java/17493/3 "2014-05-14T08:41:27Z")

</div>

thanks!

On Tue, May 13, 2014 at 1:32 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Have a look here  
> [https://github.com/dadoonet/legacy-search/blob/06-compute/src/main/java/fr/pilato/demo/legacysearch/dao/ElasticsearchDao.java#L37](https://github.com/dadoonet/legacy-search/blob/06-compute/src/main/java/fr/pilato/demo/legacysearch/dao/ElasticsearchDao.java#L37)
> 
> Should help.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 13 mai 2014 à 22:21, T Vinod Gupta [tvinod@readypulse.com](mailto:tvinod@readypulse.com) a écrit :
> 
> has anyone gotten average aggregation in java? how do you use the api to  
> create the aggregation request? it is quite confusing..
> 
> i want to do the following in java -  
> "aggregations" : { "avg\_grade" : { "avg" : { "field" : "score" }}}
> 
> thanks
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAHau4yug%3Dep6%3DFs6m8%2B8ME1uv09N9ua%3DZUdsQxWp8TG2\_02k-w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHau4yug%3Dep6%3DFs6m8%2B8ME1uv09N9ua%3DZUdsQxWp8TG2_02k-w%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAHau4yug%3Dep6%3DFs6m8%2B8ME1uv09N9ua%3DZUdsQxWp8TG2\_02k-w%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAHau4yug%3Dep6%3DFs6m8%2B8ME1uv09N9ua%3DZUdsQxWp8TG2_02k-w%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/D3079468-9639-4526-93BF-16EE195F94C4%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/D3079468-9639-4526-93BF-16EE195F94C4%40pilato.fr)[https://groups.google.com/d/msgid/elasticsearch/D3079468-9639-4526-93BF-16EE195F94C4%40pilato.fr?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/D3079468-9639-4526-93BF-16EE195F94C4%40pilato.fr?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHau4yvX4fWfOgbfD-7g9MByanvqc%3DJOdA2HLvb%2BUW-BhmL3FQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHau4yvX4fWfOgbfD-7g9MByanvqc%3DJOdA2HLvb%2BUW-BhmL3FQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:29am UTC](https://discuss.elastic.co/t/getting-average-aggregation-in-java/17493/4 "2017-07-06T01:29:30Z")

</div>


