# Avg Aggregation Histogram fields

**URL:** <https://discuss.elastic.co/t/avg-aggregation-histogram-fields/243333>\
**Category:** Elasticsearch\
**Created:** [July 31, 2020, 10:15am UTC](https://discuss.elastic.co/t/avg-aggregation-histogram-fields/243333 "2020-07-31T10:15:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kartheek91](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@kartheek91](https://discuss.elastic.co/u/kartheek91)\
**Post date:** [July 31, 2020, 10:15am UTC](https://discuss.elastic.co/t/avg-aggregation-histogram-fields/243333/1 "2020-07-31T10:15:39Z")

</div>

Hi I'm working on Elasticsearch since 2015 . Today when I'm going through the documentation I found some interesting stuff i.e

> PUT metrics\_index/\_doc/1  
> {  
> "network.name" : "net-1",  
> "latency\_histo" : {  
> "values" : [0.1, 0.2, 0.3, 0.4, 0.5],  
> "counts" : [3, 7, 23, 12, 6]  
> }  
> }
> 
> PUT metrics\_index/\_doc/2  
> {  
> "network.name" : "net-2",  
> "latency\_histo" : {  
> "values" : [0.1, 0.2, 0.3, 0.4, 0.5],  
> "counts" : [8, 17, 8, 7, 6]  
> }  
> }
> 
> POST /metrics\_index/\_search?size=0  
> {  
> "aggs": {  
> "avg\_latency":  
> { "avg": { "field": "latency\_histo" }  
> }  
> }  
> }

So \*\*avg\_latency: null \*\* when I executed above queries.May I know the reason please?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 3, 2020, 9:51am UTC](https://discuss.elastic.co/t/avg-aggregation-histogram-fields/243333/2 "2020-08-03T09:51:18Z")

</div>

Hey,

please try to provide a **full reproduction** when pasting snippets. I highly suspect, that you have not configured the `latency_histo` field to be a [histogram data type](https://www.elastic.co/guide/en/elasticsearch/reference/current/histogram.html), but I cannot be sure without a full snippet.

Thanks!

--Alex

---

<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:** [August 31, 2020, 9:51am UTC](https://discuss.elastic.co/t/avg-aggregation-histogram-fields/243333/3 "2020-08-31T09:51:26Z")

</div>

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