ES|QL dense vector functions
For more examples of these functions in action, refer to the ES|QL for search tutorial.
ES|QL supports dense vector functions for vector similarity calculations and
k-nearest neighbor search.
Dense vector functions work with
dense_vector fields
and require appropriate field mappings.
ES|QL supports these vector functions:
- Dense vector functions
EMBEDDINGGenerates dense vector embeddings from multimodal input using an inference endpoint.
KNNFinds the k nearest vectors to a query vector using a similarity metric.
TEXT_EMBEDDINGGenerates dense vector embeddings from text input using an inference endpoint.
- Vector similarity functions
V_COSINECalculates the cosine similarity between two dense_vectors.
V_DOT_PRODUCTCalculates the dot product between two dense_vectors.
V_HAMMINGCalculates the Hamming distance between two dense vectors.
V_L1_NORMCalculates the L1 norm (Manhattan distance) between two dense_vectors.
V_L2_NORMCalculates the L2 norm (Euclidean distance) between two dense_vectors.