# Sum of two fields into a one custom field

**URL:** <https://discuss.elastic.co/t/sum-of-two-fields-into-a-one-custom-field/127600>\
**Category:** Elasticsearch\
**Created:** [April 11, 2018, 9:47am UTC](https://discuss.elastic.co/t/sum-of-two-fields-into-a-one-custom-field/127600 "2018-04-11T09:47:53Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [April 11, 2018, 10:23am UTC](https://discuss.elastic.co/t/sum-of-two-fields-into-a-one-custom-field/127600/4 "2018-04-11T10:23:32Z")

</div>

As long as it's a script it will work with whatever you want. I'm not telling you how to write the script though. Which I don't know as I'm not using painless.

I always prefer modifying my data before indexing it.

---

_[View the full topic](https://discuss.elastic.co/t/sum-of-two-fields-into-a-one-custom-field/127600)._
