# Compare addresses from 2 different indices using fuzzymatch

**URL:** <https://discuss.elastic.co/t/compare-addresses-from-2-different-indices-using-fuzzymatch/162815>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-sql\
**Created:** [January 3, 2019, 1:29pm UTC](https://discuss.elastic.co/t/compare-addresses-from-2-different-indices-using-fuzzymatch/162815 "2019-01-03T13:29:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaniSusB](https://avatars.discourse-cdn.com/v4/letter/d/8e7dd6/32.png) [@DaniSusB](https://discuss.elastic.co/u/DaniSusB)\
**Post date:** [January 3, 2019, 1:29pm UTC](https://discuss.elastic.co/t/compare-addresses-from-2-different-indices-using-fuzzymatch/162815/1 "2019-01-03T13:29:39Z")

</div>

Hi,

I'd like to compare addresses from 2 different indices using a join function and fuzzymatch. In SQL it would look something like this:

SELECT my.com\_name AS MyName, cust.customer\_name AS CustName,  
my.com\_address AS MyAddress, cust.customer\_address AS CustAdress,  
my.com\_city AS MyCity, cust.customer\_city AS CustCity,  
my.com\_zip AS MyZIP, cust.customer\_zip AS CustZIP  
FROM customer.customers cust JOIN my.customers my  
ON metaphone(my.com\_name, 5) = metaphone(cust.customer\_name, 5)  
AND levenshtein(cust.customer\_name, my.com\_name) \< 5  
AND levenshtein(cust.customer\_zip, my.com\_zip) \< 2;

Is there even a possibility with 2 indices? And if, better as a nested or has\_child/has\_parent query?

---

<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 31, 2019, 1:29pm UTC](https://discuss.elastic.co/t/compare-addresses-from-2-different-indices-using-fuzzymatch/162815/2 "2019-01-31T13:29:39Z")

</div>

Closed on January 31, 2019, 1:29pm UTC

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