# Issue with min,max,mean

**URL:** <https://discuss.elastic.co/t/issue-with-min-max-mean/5263>\
**Category:** Elasticsearch\
**Created:** [August 27, 2011, 4:06am UTC](https://discuss.elastic.co/t/issue-with-min-max-mean/5263 "2011-08-27T04:06:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![einstein07](https://avatars.discourse-cdn.com/v4/letter/e/b5e925/32.png) [@einstein07](https://discuss.elastic.co/u/einstein07)\
**Post date:** [August 27, 2011, 4:06am UTC](https://discuss.elastic.co/t/issue-with-min-max-mean/5263/1 "2011-08-27T04:06:18Z")

</div>

Hi,

I have a mapping as below,

{"log\_1":{"properties":{"responsetime":  
{"index":"analyzed","type":"string"},"responsecode":  
{"index":"analyzed","type":"string"},"requesturl":  
{"type":"string"},"datetime":{"index":"analyzed","format":"dd/MMM/  
yyyy:HH:mm:ss Z","type":"date"},"bytessent":  
{"index":"analyzed","type":"string"},"ip":  
{"index":"analyzed","type":"string"},"fields":  
{"dynamic":"true","properties":{"responsetime":  
{"type":"integer"},"responsecode":{"type":"integer"},"requesturl":  
{"type":"string"},"datetime":{"format":"dd/MMM/yyyy:HH:mm:ss  
Z","type":"date"},"bytessent":{"type":"integer"},"ip":  
{"type":"ip"}}}}}}'

When I execute the below query,

{"query":{"match\_all":{}},"facets":{"user1":{"date\_histogram":  
{"field":"timestamp","interval":"second"},"facet\_filter":{"and":  
[{"range":{"timestamp":{"from":"1313661420000","to":"1413663400000"}}},  
{"term":{"text":"m2u"}}]}},"respsize":{"date\_histogram":  
{"key\_field":"timestamp","value\_field":"bytessent","interval":"minute"},"facet\_filter":  
{"and":[{"range":{"timestamp":  
{"from":"1313661420000","to":"1413663400000"}}},{"term":  
{"text":"m2u"}}]}},"resptime":{"date\_histogram":  
{"key\_field":"timestamp","value\_field":"responsetime","interval":"minute"},"facet\_filter":  
{"and":[{"range":{"timestamp":  
{"from":"1213661420000","to":"1313663400000"}}},{"term":  
{"text":"m2u"}}]}},"non200":{"date\_histogram":  
{"key\_field":"timestamp","value\_field":"responsetime","interval":"minute"},"facet\_filter":  
{"and":[{"range":{"timestamp":  
{"from":"1213661420000","to":"1313663400000"}}},{"bool":{"must\_not":  
{"term":{"responsecode":"200"}}}}]}}}}

I am not getting the correct results.. what I am getting is Infinity  
for min,max fields.

respsize: {  
\_type: date\_histogram  
entries: [  
{  
time: 1314353040000  
count: 1629  
min: Infinity  
max: -Infinity  
total: 0  
total\_count: 0  
mean: NaN  
}  
{  
time: 1314353220000  
count: 40568  
min: Infinity  
max: -Infinity  
total: 0  
total\_count: 0  
mean: NaN  
}  
{  
time: 1314353280000  
count: 1291  
min: Infinity  
max: -Infinity  
total: 0  
total\_count: 0  
mean: NaN  
}  
{  
time: 1314354240000  
count: 1719  
min: Infinity  
max: -Infinity  
total: 0  
total\_count: 0  
mean: NaN  
}  
{  
time: 1314409740000  
count: 311753  
min: Infinity  
max: -Infinity  
total: 0  
total\_count: 0  
mean: NaN  
}  
{  
time: 1314409800000  
count: 592187  
min: Infinity  
max: -Infinity  
total: 0  
total\_count: 0  
mean: NaN  
}  
]  
}

What is that I am missing?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [August 27, 2011, 6:33pm UTC](https://discuss.elastic.co/t/issue-with-min-max-mean/5263/2 "2011-08-27T18:33:59Z")

</div>

Cn you gist a recreation, hard to tell from what you pasted. See  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help).

On Sat, Aug 27, 2011 at 7:06 AM, Srinivas Pinisetti \<  
[srinivas.pinisetti@gmail.com](mailto:srinivas.pinisetti@gmail.com)\> wrote:

> Hi,
> 
> I have a mapping as below,
> 
> {"log\_1":{"properties":{"responsetime":  
> {"index":"analyzed","type":"string"},"responsecode":  
> {"index":"analyzed","type":"string"},"requesturl":  
> {"type":"string"},"datetime":{"index":"analyzed","format":"dd/MMM/  
> yyyy:HH:mm:ss Z","type":"date"},"bytessent":  
> {"index":"analyzed","type":"string"},"ip":  
> {"index":"analyzed","type":"string"},"fields":  
> {"dynamic":"true","properties":{"responsetime":  
> {"type":"integer"},"responsecode":{"type":"integer"},"requesturl":  
> {"type":"string"},"datetime":{"format":"dd/MMM/yyyy:HH:mm:ss  
> Z","type":"date"},"bytessent":{"type":"integer"},"ip":  
> {"type":"ip"}}}}}}'
> 
> When I execute the below query,
> 
> {"query":{"match\_all":{}},"facets":{"user1":{"date\_histogram":  
> {"field":"timestamp","interval":"second"},"facet\_filter":{"and":  
> [{"range":{"timestamp":{"from":"1313661420000","to":"1413663400000"}}},  
> {"term":{"text":"m2u"}}]}},"respsize":{"date\_histogram":
> 
> {"key\_field":"timestamp","value\_field":"bytessent","interval":"minute"},"facet\_filter":  
> {"and":[{"range":{"timestamp":  
> {"from":"1313661420000","to":"1413663400000"}}},{"term":  
> {"text":"m2u"}}]}},"resptime":{"date\_histogram":
> 
> {"key\_field":"timestamp","value\_field":"responsetime","interval":"minute"},"facet\_filter":  
> {"and":[{"range":{"timestamp":  
> {"from":"1213661420000","to":"1313663400000"}}},{"term":  
> {"text":"m2u"}}]}},"non200":{"date\_histogram":
> 
> {"key\_field":"timestamp","value\_field":"responsetime","interval":"minute"},"facet\_filter":  
> {"and":[{"range":{"timestamp":  
> {"from":"1213661420000","to":"1313663400000"}}},{"bool":{"must\_not":  
> {"term":{"responsecode":"200"}}}}]}}}}
> 
> I am not getting the correct results.. what I am getting is Infinity  
> for min,max fields.
> 
> respsize: {  
> \_type: date\_histogram  
> entries: [  
> {  
> time: 1314353040000  
> count: 1629  
> min: Infinity  
> max: -Infinity  
> total: 0  
> total\_count: 0  
> mean: NaN  
> }  
> {  
> time: 1314353220000  
> count: 40568  
> min: Infinity  
> max: -Infinity  
> total: 0  
> total\_count: 0  
> mean: NaN  
> }  
> {  
> time: 1314353280000  
> count: 1291  
> min: Infinity  
> max: -Infinity  
> total: 0  
> total\_count: 0  
> mean: NaN  
> }  
> {  
> time: 1314354240000  
> count: 1719  
> min: Infinity  
> max: -Infinity  
> total: 0  
> total\_count: 0  
> mean: NaN  
> }  
> {  
> time: 1314409740000  
> count: 311753  
> min: Infinity  
> max: -Infinity  
> total: 0  
> total\_count: 0  
> mean: NaN  
> }  
> {  
> time: 1314409800000  
> count: 592187  
> min: Infinity  
> max: -Infinity  
> total: 0  
> total\_count: 0  
> mean: NaN  
> }  
> ]  
> }
> 
> What is that I am missing?

---

<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, 3:55am UTC](https://discuss.elastic.co/t/issue-with-min-max-mean/5263/3 "2017-07-06T03:55:48Z")

</div>


