# Scripted fields: Coalesce

**URL:** <https://discuss.elastic.co/t/scripted-fields-coalesce/278515>\
**Category:** Kibana\
**Created:** [July 13, 2021, 9:40am UTC](https://discuss.elastic.co/t/scripted-fields-coalesce/278515 "2021-07-13T09:40:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ITchandj](https://avatars.discourse-cdn.com/v4/letter/i/f19dbf/32.png) [@ITchandj](https://discuss.elastic.co/u/ITchandj)\
**Post date:** [July 13, 2021, 9:40am UTC](https://discuss.elastic.co/t/scripted-fields-coalesce/278515/1 "2021-07-13T09:40:33Z")

</div>

Hello!!!

i want to write a scripted fields that do the following calculation. how should i do it.

Procuser = coalesce (ProcUserExpanded, ProcUser)

---

<div class="post-metadata">

**Author:** ![cheiligers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cheiligers/32/73114_2.png) [@cheiligers](https://discuss.elastic.co/u/cheiligers)\
**Post date:** [July 14, 2021, 6:46pm UTC](https://discuss.elastic.co/t/scripted-fields-coalesce/278515/2 "2021-07-14T18:46:47Z")

</div>

@ITchandj I don't know what version you are using but please note that scripted fields are being deprecated (as of version 7.13) and you should rather use runtime fields.

The docs explain [using both](https://www.elastic.co/guide/en/kibana/7.13/managing-index-patterns.html#managing-index-patterns) well.

There's a [great tutorial on scripted fields](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-using.html#modules-scripting-using) in the docs too.

---

<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 11, 2021, 6:46pm UTC](https://discuss.elastic.co/t/scripted-fields-coalesce/278515/3 "2021-08-11T18:46:52Z")

</div>

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