# Painless, if two field exists then calculate

**URL:** https://discuss.elastic.co/t/painless-if-two-field-exists-then-calculate/117489
**Category:** Kibana
**Created:** [January 29, 2018, 3:55pm UTC](https://discuss.elastic.co/t/painless-if-two-field-exists-then-calculate/117489 "2018-01-29T15:55:49Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![srolskyi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srolskyi/32/24788_2.png) [@srolskyi](https://discuss.elastic.co/u/srolskyi)
#### Post date: [January 30, 2018, 3:07pm UTC](https://discuss.elastic.co/t/painless-if-two-field-exists-then-calculate/117489/6 "2018-01-30T15:07:11Z")

</div>

Hi,  
I open the same event on two different ELK (5.5.1 and 6.1.1) on kibana and switch to "json" view:

 ![Screenshot%20at%202018-56-30%2016-56-18](https://us1.discourse-cdn.com/elastic/original/3X/a/a/aa817b1063d75f64cafd4d8d362f8f2b3dcd559d.png)

all timestamp fields for version 6.1.1 have a format "text" for version 5.1.1 have format "Unix time". Fields have the same look and same type = date, difference only in "json" view.  
for my script, I chose type =number, Format = Number.  
this works on es 5.5.1

---

_[View the full topic](https://discuss.elastic.co/t/painless-if-two-field-exists-then-calculate/117489)._
