Skip to content

ES|QL - kNN function initial support #127322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

carlosdelest
Copy link
Member

@carlosdelest carlosdelest commented Apr 24, 2025

This is the first step to support kNN as a search function in ES|QL:

  • Adds minimal support for dense_vector field type (returns NULL values for it). Includes a feature flag to keep developing it.
  • Adds a kNN function under snapshot builds
  • kNN function receives a field and a query as a numeric vector, and performs a kNN query with defaults (k=10, num_cands=15)

Missing from this PR are:

  • Function tests
  • Query validation to ensure it's a multivalued literal
  • CSV tests
  • Optimizer tests to ensure it's pushed down to Lucene
  • knn options
  • QueryBuilder rewriting
  • Support for including a text query + an inference ID to calculate vector
  • Support for executing the function without being pushed down to Lucene
  • Include filters as prefilters in kNN
  • Consider to use kNN top-level vs kNN query
  • Function docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants