Loading

ES|QL dense vector functions

Tip

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
    • EMBEDDING

      Generates dense vector embeddings from multimodal input using an inference endpoint.

    • KNN

      Finds the k nearest vectors to a query vector using a similarity metric.

    • TEXT_EMBEDDING

      Generates dense vector embeddings from text input using an inference endpoint.

  • Vector similarity functions
    • V_COSINE

      Calculates the cosine similarity between two dense_vectors.

    • V_DOT_PRODUCT

      Calculates the dot product between two dense_vectors.

    • V_HAMMING

      Calculates the Hamming distance between two dense vectors.

    • V_L1_NORM

      Calculates the L1 norm (Manhattan distance) between two dense_vectors.

    • V_L2_NORM

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