﻿---
title: ES|QL V_HAMMING function
description: 
url: https://www.elastic.co/elastic/docs-builder/docs/3028/reference/query-languages/esql/functions-operators/dense-vector-functions/v_hamming
products:
  - Elasticsearch
---

# ES|QL V_HAMMING function
<applies-to>
  - Elastic Stack: Preview in 9.3
</applies-to>


## Syntax

![Embedded](https://www.elastic.co/elastic/docs-builder/docs/3028/reference/query-languages/esql/images/functions/v_hamming.svg)


## Parameters

<definitions>
  <definition term="left">
    First dense_vector to use to calculate the Hamming distance
  </definition>
  <definition term="right">
    Second dense_vector to use to calculate the Hamming distance
  </definition>
</definitions>


## Description

Calculates the Hamming distance between two dense vectors.

## Supported types


| left         | right        | result |
|--------------|--------------|--------|
| dense_vector | dense_vector | double |


## Example

```esql
from colors
| eval similarity = v_hamming(rgb_byte_vector, [0, 127, 127])
| sort similarity desc, color asc
```


| color:text | similarity:double |
|------------|-------------------|
| red        | 23.0              |
| indigo     | 19.0              |
| orange     | 19.0              |
| black      | 17.0              |
| gold       | 17.0              |
| bisque     | 16.0              |
| chartreuse | 16.0              |
| green      | 16.0              |
| maroon     | 16.0              |
| navy       | 16.0              |