# Hamming Distance on Binary strings

**URL:** <https://discuss.elastic.co/t/hamming-distance-on-binary-strings/5257>\
**Category:** Elasticsearch\
**Created:** [August 26, 2011, 10:50am UTC](https://discuss.elastic.co/t/hamming-distance-on-binary-strings/5257 "2011-08-26T10:50:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anahap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anahap/32/1503_2.png) [@anahap](https://discuss.elastic.co/u/anahap)\
**Post date:** [August 26, 2011, 10:50am UTC](https://discuss.elastic.co/t/hamming-distance-on-binary-strings/5257/1 "2011-08-26T10:50:51Z")

</div>

Hi there,

Does anyone know the best way to store fixedlength binary data and query it,  
while scoring with hamming distance?  
A hamming distance filter with a threshold would also be ok.

Thanks a lot, this is useful for all kinds of similarity searches based on  
fingerprinting algorithms.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [August 26, 2011, 3:08pm UTC](https://discuss.elastic.co/t/hamming-distance-on-binary-strings/5257/2 "2011-08-26T15:08:57Z")

</div>

You can use fuzzy queries for Levenshtein distance, but note that they are  
slow(er) in Lucene 3.3, will be much faster in Lucene 4.0 (when it comes  
out).

On Fri, Aug 26, 2011 at 1:50 PM, anahap [andy@nahapetian.com](mailto:andy@nahapetian.com) wrote:

> Hi there,
> 
> Does anyone know the best way to store fixedlength binary data and query  
> it, while scoring with hamming distance?  
> A hamming distance filter with a threshold would also be ok.
> 
> Thanks a lot, this is useful for all kinds of similarity searches based on  
> fingerprinting algorithms.

---

<div class="post-metadata">

**Author:** ![Catalin\_Banu](https://avatars.discourse-cdn.com/v4/letter/c/f05b48/32.png) [@Catalin\_Banu](https://discuss.elastic.co/u/Catalin_Banu)\
**Post date:** [November 13, 2013, 10:08am UTC](https://discuss.elastic.co/t/hamming-distance-on-binary-strings/5257/3 "2013-11-13T10:08:04Z")

</div>

Hi,

Did you find a solution?

On Friday, August 26, 2011 1:50:51 PM UTC+3, anahap wrote:

> Hi there,
> 
> Does anyone know the best way to store fixedlength binary data and query  
> it, while scoring with hamming distance?  
> A hamming distance filter with a threshold would also be ok.
> 
> Thanks a lot, this is useful for all kinds of similarity searches based on  
> fingerprinting algorithms.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:07am UTC](https://discuss.elastic.co/t/hamming-distance-on-binary-strings/5257/4 "2017-07-06T02:07:33Z")

</div>


