# How I can get 2 fields values in Elastic Search

**URL:** <https://discuss.elastic.co/t/how-i-can-get-2-fields-values-in-elastic-search/384419>\
**Category:** Kibana\
**Created:** [January 7, 2026, 4:42pm UTC](https://discuss.elastic.co/t/how-i-can-get-2-fields-values-in-elastic-search/384419 "2026-01-07T16:42:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SivaK](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@SivaK](https://discuss.elastic.co/u/SivaK)\
**Post date:** [January 7, 2026, 4:42pm UTC](https://discuss.elastic.co/t/how-i-can-get-2-fields-values-in-elastic-search/384419/1 "2026-01-07T16:42:32Z")

</div>

I am trying as follows :

- Create visualization of custom field, which is addition of 2 available fields. How I can get this, so in my dashboard data updates automatically.

---

<div class="post-metadata">

**Author:** ![Tortoise](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tortoise/32/147587_2.png) [@Tortoise](https://discuss.elastic.co/u/Tortoise)\
**Post date:** [January 8, 2026, 7:05am UTC](https://discuss.elastic.co/t/how-i-can-get-2-fields-values-in-elastic-search/384419/2 "2026-01-08T07:05:56Z")

</div>

Hello @SivaK

Please share more information about the data you have and what is your expectations?

If you have 2 number fields & you need a custom field created as sum of these 2 number fields below can be a simple formula :

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/8/28130d1bed227b04ccd1292b525b5d6d0599f8b3.png)

Thanks!!

---

<div class="post-metadata">

**Author:** ![SivaK](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@SivaK](https://discuss.elastic.co/u/SivaK)\
**Post date:** [January 8, 2026, 9:24am UTC](https://discuss.elastic.co/t/how-i-can-get-2-fields-values-in-elastic-search/384419/3 "2026-01-08T09:24:19Z")

</div>

Thanks for responding back .. !! Yes this works for the fields with values. If the field is keyword then do we have any possible ways for enabling the similar functionality.

Example , price.keyword provides 200, tax.keyword provides 100 and now I want to have custom-sum of price.keyword and tax.keyword

---

<div class="post-metadata">

**Author:** ![Tortoise](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tortoise/32/147587_2.png) [@Tortoise](https://discuss.elastic.co/u/Tortoise)\
**Post date:** [January 8, 2026, 11:32am UTC](https://discuss.elastic.co/t/how-i-can-get-2-fields-values-in-elastic-search/384419/4 "2026-01-08T11:32:26Z")

</div>

Hello @SivaK

You will have to create a runtime field from this .keyword field if you want to perform sum on keyword fields.

Similar post :

> [@Can I do a sum on the fields that have 'keyword' type](https://discuss.elastic.co/t/can-i-do-a-sum-on-the-fields-that-have-keyword-type/333076):
>
> I have a field that is keyword type. The index looks like this: { "key": 1 }, { "key": 2 }, { "key": 3 }, { "key":"abc" }, { "key":"zyx" } Some values are numeric and some are strings. Is there a way to sum all numeric keywords such that the value comes to 1+2+3 = 6 Is some form type casting possible?

Thanks!!

---

<div class="post-metadata">

**Author:** ![RainTown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raintown/32/140206_2.png) [@RainTown](https://discuss.elastic.co/u/RainTown)\
**Post date:** [January 8, 2026, 11:53am UTC](https://discuss.elastic.co/t/how-i-can-get-2-fields-values-in-elastic-search/384419/5 "2026-01-08T11:53:12Z")

</div>

There are other approaches too, for example @SivaK should maybe revisit the index's mapping for these fields. "price" would seem to be naturally a number, similarly (in this context) "tax". Maybe sometimes the field is presented with (eg) a currency symbol, e.g. $12, or other messiness, which can often be handled in an index pipeline.

---

<div class="post-metadata">

**Author:** ![SivaK](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@SivaK](https://discuss.elastic.co/u/SivaK)\
**Post date:** [January 8, 2026, 11:55am UTC](https://discuss.elastic.co/t/how-i-can-get-2-fields-values-in-elastic-search/384419/6 "2026-01-08T11:55:13Z")

</div>

Hello @Tortoise ,

Do we have any example on how to include in runtime ?

Thanks ..!!

---

<div class="post-metadata">

**Author:** ![Tortoise](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tortoise/32/147587_2.png) [@Tortoise](https://discuss.elastic.co/u/Tortoise)\
**Post date:** [January 8, 2026, 12:46pm UTC](https://discuss.elastic.co/t/how-i-can-get-2-fields-values-in-elastic-search/384419/7 "2026-01-08T12:46:01Z")

</div>

Hello @SivaK

Could you please share the data/mapping without which we cannot suggest anything.

Example was from the tax.keyword field i will have to create a new runtime field with name tax\_r with a script which will convert the value to number & this field could be used as a sum on dashboard.

Thanks!!

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [January 8, 2026, 2:59pm UTC](https://discuss.elastic.co/t/how-i-can-get-2-fields-values-in-elastic-search/384419/8 "2026-01-08T14:59:06Z")

</div>

Hi @SivaK

What version are you on?

Can you provide a couple of actual examples of your docs?

This would be fairly trivial using ESQL with the `EVAL` operator which allows you to do math and casting
