Add helper function to pack dense vectors for efficient uploading#3219
Merged
miguelgrinberg merged 4 commits intoelastic:mainfrom Dec 11, 2025
Merged
Add helper function to pack dense vectors for efficient uploading#3219miguelgrinberg merged 4 commits intoelastic:mainfrom
miguelgrinberg merged 4 commits intoelastic:mainfrom
Conversation
dde9f2d to
8c198a2
Compare
8c198a2 to
145008e
Compare
145008e to
88a903a
Compare
88a903a to
7699269
Compare
7699269 to
dc9c7c7
Compare
dc9c7c7 to
453e383
Compare
pquentin
approved these changes
Dec 9, 2025
elasticsearch/helpers/actions.py
Outdated
Comment on lines
+717
to
+720
| def pack_dense_vector(vector: Union["np.ndarray", Sequence[float]]) -> str: | ||
| """Helper function that packs a dense vector for efficient uploading. | ||
|
|
||
| :arg v: the list or numpy array to pack. |
Member
There was a problem hiding this comment.
I like the name, because it means we can support more than numpy in the future if we want to.
Contributor
Author
There was a problem hiding this comment.
Even now, you can pass a list of floats and it will handle it too (I'm converting the list to numpy inside the function though).
39c981f to
3330f72
Compare
aca4e6b to
61e1be5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a utility function to encode dense vectors in base64 binary encoding for better ingest performance. There is also a benchmark script for this feature.