# Comprae values between to strings

**URL:** https://discuss.elastic.co/t/comprae-values-between-to-strings/212750
**Category:** Kibana
**Created:** [December 21, 2019, 6:30pm UTC](https://discuss.elastic.co/t/comprae-values-between-to-strings/212750 "2019-12-21T18:30:37Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Yoav\_Ben\_Moha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yoav_ben_moha/32/46202_2.png) [@Yoav\_Ben\_Moha](https://discuss.elastic.co/u/Yoav_Ben_Moha)
#### Post date: [December 21, 2019, 6:30pm UTC](https://discuss.elastic.co/t/comprae-values-between-to-strings/212750/1 "2019-12-21T18:30:37Z")

</div>

Hi,  
Please consider the following case.  
I have an index named : FRAUD  
I would like to display all the documents that field A is equal to field B  
fields A and B are of string data type.

in sqlplus its looks like that

```
select a,b,c
from FRAUD
where a=b;

```

Please advise  
Thanks  
Yoav

---

<div class="post-metadata">

### Author: ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)
#### Post date: [December 23, 2019, 4:51pm UTC](https://discuss.elastic.co/t/comprae-values-between-to-strings/212750/2 "2019-12-23T16:51:22Z")

</div>

The most efficient way to do this is at ingestion time with an ingest node processor.

If this data is already indexed, you'll want to create a scripted field. The scripted field would output true or false, and then you'd query on that field.

e.g. script that creates a field`d = (a == b)` and a query `d: true`

---

<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: [January 20, 2020, 4:51pm UTC](https://discuss.elastic.co/t/comprae-values-between-to-strings/212750/3 "2020-01-20T16:51:28Z")

</div>

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