Type to search.

ES|QL V_L2_NORM function

Serverless

Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

Serverless interfaces and procedures might differ from classic Elastic Stack deployments.

Stack GA 9.4+ …

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.

Availability

  • Generally available since 9.4

    This functionality is generally available and ready for production usage.

  • Preview in 9.3

    This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply.

Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

Calculates the L2 norm (Euclidean distance) between two dense_vectors.

Embedded
Embedded
left
first dense_vector to calculate l2 norm similarity
right

second dense_vector to calculate l2 norm similarity

Calculates the l2 norm between two dense_vectors.

left right result
dense_vector dense_vector double
ES|QL
from colors
| eval similarity = v_l2_norm(rgb_vector, [0, 255, 255])
| sort similarity desc, color asc
color:text similarity:double
red 441.6729431152344
maroon 382.6669616699219
crimson 376.36419677734375
orange 371.68536376953125
gold 362.8360595703125
black 360.62445068359375
magenta 360.62445068359375
yellow 360.62445068359375
firebrick 359.67486572265625
tomato 351.0227966308594