# Compare 2 fields in Search - Kibana

**URL:** <https://discuss.elastic.co/t/compare-2-fields-in-search-kibana/237362>\
**Category:** Kibana\
**Created:** [June 16, 2020, 9:09pm UTC](https://discuss.elastic.co/t/compare-2-fields-in-search-kibana/237362 "2020-06-16T21:09:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![snambu5878](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/snambu5878/32/45746_2.png) [@snambu5878](https://discuss.elastic.co/u/snambu5878)\
**Post date:** [June 16, 2020, 9:09pm UTC](https://discuss.elastic.co/t/compare-2-fields-in-search-kibana/237362/1 "2020-06-16T21:09:40Z")

</div>

```auto
Hi Team,

We were asked a question by business whether we can produce a search result comparing 2 fields. 

For Ex: submitted_amt > paid_amt

Usually In Kibana we can do submitted_amt >= or <= 1000 on a value. The requirement here is compare with 2 different column fields. I see some blogs that tells us to use scripted fields but they are not searchable. There is this enhanced table plugin that we can use but not sure if it is searchable and the plugin has issues searching large data sets.

Appreciate your quick help on this.

Thanks,
Sri

```

---

<div class="post-metadata">

**Author:** ![mattkime](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattkime/32/43522_2.png) [@mattkime](https://discuss.elastic.co/u/mattkime)\
**Post date:** [June 16, 2020, 10:02pm UTC](https://discuss.elastic.co/t/compare-2-fields-in-search-kibana/237362/2 "2020-06-16T22:02:21Z")

</div>

@snambu5878

Which version of Kibana are you using? You can certainly filter on scripted fields - [https://www.elastic.co/guide/en/kibana/current/scripted-fields.html](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html) - although it would be helpful to verify this is true for the version you're running.

Thanks,  
Matt

---

<div class="post-metadata">

**Author:** ![snambu5878](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/snambu5878/32/45746_2.png) [@snambu5878](https://discuss.elastic.co/u/snambu5878)\
**Post date:** [June 17, 2020, 2:52am UTC](https://discuss.elastic.co/t/compare-2-fields-in-search-kibana/237362/3 "2020-06-17T02:52:44Z")

</div>

Thanks for your reply. Our Kibana version is 7.6.0

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

Here in the scripted fields I see search is not enabled.

Regards,  
Sri

---

<div class="post-metadata">

**Author:** ![mattkime](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattkime/32/43522_2.png) [@mattkime](https://discuss.elastic.co/u/mattkime)\
**Post date:** [June 17, 2020, 2:54am UTC](https://discuss.elastic.co/t/compare-2-fields-in-search-kibana/237362/4 "2020-06-17T02:54:43Z")

</div>

From the url I provided -

```auto
You query scripted fields with the [Kibana query language](https://www.elastic.co/guide/en/kibana/current/kuery-query.html), and can filter them using the filter bar.

```

I would say that text is misleading and perhaps should be removed.

---

<div class="post-metadata">

**Author:** ![snambu5878](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/snambu5878/32/45746_2.png) [@snambu5878](https://discuss.elastic.co/u/snambu5878)\
**Post date:** [June 17, 2020, 1:13pm UTC](https://discuss.elastic.co/t/compare-2-fields-in-search-kibana/237362/5 "2020-06-17T13:13:47Z")

</div>

Thanks for your reply. But we are looking for search and filter is not an option. Is there any other option that you can recommend?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/c/6c6be41a62ff9a4da6026521f33013e7a8958f1b.png)

Thanks,  
Sri

---

<div class="post-metadata">

**Author:** ![mattkime](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattkime/32/43522_2.png) [@mattkime](https://discuss.elastic.co/u/mattkime)\
**Post date:** [June 17, 2020, 3:29pm UTC](https://discuss.elastic.co/t/compare-2-fields-in-search-kibana/237362/6 "2020-06-17T15:29:23Z")

</div>

Can you show me the search you wish to perform?

---

<div class="post-metadata">

**Author:** ![snambu5878](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/snambu5878/32/45746_2.png) [@snambu5878](https://discuss.elastic.co/u/snambu5878)\
**Post date:** [June 17, 2020, 6:37pm UTC](https://discuss.elastic.co/t/compare-2-fields-in-search-kibana/237362/7 "2020-06-17T18:37:48Z")

</div>

Sure Matt. Something like below. This is just illustration on how we would like to have. Actual columns may vary.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/4/c4f73774e299feaea05fe82836d2f03d7d36e588.png)

---

<div class="post-metadata">

**Author:** ![mattkime](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattkime/32/43522_2.png) [@mattkime](https://discuss.elastic.co/u/mattkime)\
**Post date:** [June 21, 2020, 4:52am UTC](https://discuss.elastic.co/t/compare-2-fields-in-search-kibana/237362/8 "2020-06-21T04:52:35Z")

</div>

I'm doing some research into how scripting fields can help. It seems they should be able to even with their limitations.

Another option would be to update the documents - [https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html)

---

<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:** [July 19, 2020, 4:52am UTC](https://discuss.elastic.co/t/compare-2-fields-in-search-kibana/237362/9 "2020-07-19T04:52:39Z")

</div>

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