# Getting a value in each document based on other fields calculation

**URL:** <https://discuss.elastic.co/t/getting-a-value-in-each-document-based-on-other-fields-calculation/241799>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [July 19, 2020, 2:46pm UTC](https://discuss.elastic.co/t/getting-a-value-in-each-document-based-on-other-fields-calculation/241799 "2020-07-19T14:46:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![igorid70](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igorid70/32/45136_2.png) [@igorid70](https://discuss.elastic.co/u/igorid70)\
**Post date:** [July 19, 2020, 2:46pm UTC](https://discuss.elastic.co/t/getting-a-value-in-each-document-based-on-other-fields-calculation/241799/1 "2020-07-19T14:46:30Z")

</div>

Hi  
I need to get a value in each document which is a calculation based on some other metricbeat feilds. The problem is that I can't use scripted fields because I don't need it for visualization/Kibana but accessing those values via perl or python DSL. I was looking for add\_fields processor, however it looks it can use only static definitions. An example for values I need - CPU % usage (e.g. in scripted fields it would be doc['system.cpu.total.pct'].value \* 100/doc['system.cpu.cores'].value)

---

<div class="post-metadata">

**Author:** ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)\
**Post date:** [July 20, 2020, 9:31am UTC](https://discuss.elastic.co/t/getting-a-value-in-each-document-based-on-other-fields-calculation/241799/2 "2020-07-20T09:31:29Z")

</div>

You can achieve something similar doing some magic using an Ingest node [https://www.elastic.co/guide/en/elasticsearch/reference/master/ingest.html](https://www.elastic.co/guide/en/elasticsearch/reference/master/ingest.html)

---

<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 17, 2020, 11:31am UTC](https://discuss.elastic.co/t/getting-a-value-in-each-document-based-on-other-fields-calculation/241799/3 "2020-08-17T11:31:34Z")

</div>

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