Skip to content
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

Allow float[] with byte[] comparisons for cosine and dotProduct for dense_vector scripting #117274

Closed
benwtrent opened this issue Nov 21, 2024 · 3 comments · Fixed by #122381
Closed
Labels
>enhancement :Search Relevance/Vectors Vector search Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch

Comments

@benwtrent
Copy link
Member

Description

Right now, for vectors stored as element_type: byte we disallow scripting functions to be calculated with floating point query. However, if the user used some external quantization methodology, allowing the asymmetric distance calculation like this might be useful.

Since we already calculate magnitude for everything, the implementation will be fairly trivial.

The one aspect around this that might be "slow" is the actual vector ops. We have no SIMD optimized operations between float[], byte[] for dot-product. But, that should be fairly simple to do.

@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Nov 21, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

@thecoop
Copy link
Member

thecoop commented Mar 10, 2025

Is there a use case for the other way? Using float doc vector with byte query vectors?

@benwtrent
Copy link
Member Author

Is there a use case for the other way? Using float doc vector with byte query vectors?

I don't really see that as an important action. While it might be weird to not support it, from the end user side of things, we already support this. We just keep the byte query vector as a float. One exception might be the support for hexidecimal strings. Which, eh, I am not sure that is important for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search Relevance/Vectors Vector search Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants