# How to get some statistic number in custom script?

**URL:** <https://discuss.elastic.co/t/how-to-get-some-statistic-number-in-custom-script/49842>\
**Category:** Elasticsearch\
**Created:** [May 12, 2016, 1:52am UTC](https://discuss.elastic.co/t/how-to-get-some-statistic-number-in-custom-script/49842 "2016-05-12T01:52:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Morriaty](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@Morriaty](https://discuss.elastic.co/u/Morriaty)\
**Post date:** [May 12, 2016, 1:52am UTC](https://discuss.elastic.co/t/how-to-get-some-statistic-number-in-custom-script/49842/1 "2016-05-12T01:52:21Z")

</div>

For example, I wanna normalize one field. So I need the max and min value of this field.

![](https://us1.discourse-cdn.com/elastic/original/2X/5/58a7feaa8ea8b809d02f623eb57e806b2c916356.png)

In the document, I only found this three statistic

> \_index['FIELD'].docCount()  
> Number of documents containing the field FIELD. Does not take deleted documents into account.  
> \_index['FIELD'].sumttf()  
> Sum of ttf over all terms that appear in field FIELD in all documents.  
> \_index['FIELD'].sumdf()  
> The sum of df s over all terms that appear in field FIELD in all documents.

---

<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:52pm UTC](https://discuss.elastic.co/t/how-to-get-some-statistic-number-in-custom-script/49842/2 "2017-07-05T22:52:17Z")

</div>


