# Compare two columns with fuzziness or slops

**URL:** <https://discuss.elastic.co/t/compare-two-columns-with-fuzziness-or-slops/195286>\
**Category:** Elasticsearch\
**Created:** [August 15, 2019, 1:09am UTC](https://discuss.elastic.co/t/compare-two-columns-with-fuzziness-or-slops/195286 "2019-08-15T01:09:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alltheway99](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@alltheway99](https://discuss.elastic.co/u/alltheway99)\
**Post date:** [August 15, 2019, 1:09am UTC](https://discuss.elastic.co/t/compare-two-columns-with-fuzziness-or-slops/195286/1 "2019-08-15T01:09:37Z")

</div>

Hi,  
I'm trying to compare two columns such as address1 and address2, but also want to apply fuzziness or slop values. I could get the exact match in the following in Kibana.

GET /my\_index/\_search  
{  
"query": {  
"bool": {  
"must": [  
{  
"script": {  
"script": "doc['address1.keyword'].value==doc['address2.keyword'].value"  
}  
}  
]  
}  
}  
}

But I couldn't apply fuzziness or slop values on script.  
Is there any (better) way to perform this task?

Thanks

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 15, 2019, 7:19am UTC](https://discuss.elastic.co/t/compare-two-columns-with-fuzziness-or-slops/195286/2 "2019-08-15T07:19:00Z")

</div>

that is not really possible with access doc values, as you cannot execute another analysis and search step after receiving those values.

Can you explain, what exactly is your use-case? Maybe there is another way to work this out, but I am totally lacking context and I am curious to know more 🙂

---

<div class="post-metadata">

**Author:** ![alltheway99](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@alltheway99](https://discuss.elastic.co/u/alltheway99)\
**Post date:** [August 15, 2019, 10:24pm UTC](https://discuss.elastic.co/t/compare-two-columns-with-fuzziness-or-slops/195286/3 "2019-08-15T22:24:11Z")

</div>

Let's say I have a table whose two fields are address1 and address2. Not only that I want to find out how many times these two fields are exactly the same, but also (more importantly) when they are different, I want to find if they can be considered the same using fuzziness or slop values.  
Ex: "Adam Street" vs "Adams Street" using fuzziness=1, "Adam Street" vs "Street Adam" using slop=2.  
Any advice would be appreciated.  
Thanks

---

<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:** [September 12, 2019, 10:24pm UTC](https://discuss.elastic.co/t/compare-two-columns-with-fuzziness-or-slops/195286/4 "2019-09-12T22:24:20Z")

</div>

Closed on September 12, 2019, 10:24pm UTC

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