# Compare two fields in Kibana

**URL:** https://discuss.elastic.co/t/compare-two-fields-in-kibana/369399
**Category:** Kibana
**Created:** [October 25, 2024, 7:28am UTC](https://discuss.elastic.co/t/compare-two-fields-in-kibana/369399 "2024-10-25T07:28:15Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![cyberzlo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cyberzlo/32/65490_2.png) [@cyberzlo](https://discuss.elastic.co/u/cyberzlo)
#### Post date: [October 25, 2024, 7:28am UTC](https://discuss.elastic.co/t/compare-two-fields-in-kibana/369399/1 "2024-10-25T07:28:15Z")

</div>

Hi, regarding

> [@How can kibana compare two fields?](https://discuss.elastic.co/t/how-can-kibana-compare-two-fields/282918/8):
>
> It looks like you've put the formula into the runtime\_fields editor. Formulas are a Lens specific feature:

is this currenly possible to compare values of 2 fields?  
like whether the content of field X is different/the same as content of field Y

---

<div class="post-metadata">

### Author: ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)
#### Post date: [October 25, 2024, 8:42am UTC](https://discuss.elastic.co/t/compare-two-fields-in-kibana/369399/2 "2024-10-25T08:42:55Z")

</div>

Hi @cyberzlo

from the linked topic I see your requirement is to perform some data comparison/transformation within Maps.  
In recent version a new layer type has been added to Maps with ES|QL (the new ES language) which could help to achieve what you're looking for.

---

<div class="post-metadata">

### Author: ![cyberzlo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cyberzlo/32/65490_2.png) [@cyberzlo](https://discuss.elastic.co/u/cyberzlo)
#### Post date: [October 25, 2024, 12:57pm UTC](https://discuss.elastic.co/t/compare-two-fields-in-kibana/369399/3 "2024-10-25T12:57:03Z")

</div>

This wasnt my topic, I am not looking for maps :-). I have just aplication logs and want compare values from other documents (other logs entries). Is it possible some normal/easy way without any workarounds?

---

<div class="post-metadata">

### Author: ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)
#### Post date: [October 25, 2024, 1:16pm UTC](https://discuss.elastic.co/t/compare-two-fields-in-kibana/369399/4 "2024-10-25T13:16:35Z")

</div>

If it's about Maps you can use Lens formula or ES|QL.  
Lens formula introduced a new `ifelse` function to help with this kind of tasks.

With the new ES|QL language there's an existing `case` function to achieve the same goal.

---

<div class="post-metadata">

### Author: ![cyberzlo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cyberzlo/32/65490_2.png) [@cyberzlo](https://discuss.elastic.co/u/cyberzlo)
#### Post date: [November 16, 2024, 10:19am UTC](https://discuss.elastic.co/t/compare-two-fields-in-kibana/369399/5 "2024-11-16T10:19:45Z")

</div>

Is it possible on Dashboard or Discover - so with filter or KQL?

Where in Lens is this `ifelse` function?

---

<div class="post-metadata">

### Author: ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)
#### Post date: [December 6, 2024, 11:12am UTC](https://discuss.elastic.co/t/compare-two-fields-in-kibana/369399/6 "2024-12-06T11:12:04Z")

</div>

You can find direction to use Lens formula here: [Create visualizations with Lens | Kibana Guide [8.16] | Elastic](https://www.elastic.co/guide/en/kibana/current/lens.html#lens-formulas)
