-
Notifications
You must be signed in to change notification settings - Fork 26k
[ES|QL]: Update Vector Similarity To Support BFLOAT16 #139113
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
Merged
Mikep86
merged 45 commits into
elastic:main
from
mromaios:bfloat16_esql_and_semantic_text_tests
Dec 15, 2025
Merged
Changes from 38 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
a994d14
test: add some es|ql and semantic text bfloat16 tests
mromaios 201947f
[CI] Auto commit changes from spotless
dbef73a
add missing spec
mromaios a5a925a
Merge branch 'bfloat16_esql_and_semantic_text_tests' of github.com:mr…
mromaios d8f699a
drop column
mromaios 32945e7
Merge branch 'main' of github.com:elastic/elasticsearch into bfloat16…
mromaios db5d9aa
Merge branch 'main' of github.com:elastic/elasticsearch into bfloat16…
mromaios cfbea9c
remove bfloat16 exception in mapper
mromaios 43a1a39
fix es|ql csv test column name
mromaios 3b7d930
adjust tests
mromaios c5746e7
Merge branch 'main' of github.com:elastic/elasticsearch into bfloat16…
mromaios 88b3106
rename spec
mromaios c1af0a3
add separate mapping for bfloat16
mromaios eefee7b
[CI] Auto commit changes from spotless
a3277ec
remove csv filenames
mromaios 55f46a4
Merge branch 'bfloat16_esql_and_semantic_text_tests' of github.com:mr…
mromaios b42a52c
fix dense_vector.csv format
mromaios a1d9fae
update expected
mromaios c9adbf4
adjust tests
mromaios 78a32c4
[CI] Auto commit changes from spotless
16a8c65
update tests
mromaios aec2f99
Merge branch 'bfloat16_esql_and_semantic_text_tests' of github.com:mr…
mromaios 29bc4de
[CI] Auto commit changes from spotless
c41b060
update expected values
mromaios 35b38d2
Merge branch 'bfloat16_esql_and_semantic_text_tests' of github.com:mr…
mromaios 0806bba
[CI] Auto commit changes from spotless
50469b6
add tests
mromaios 4244ffc
Merge branch 'bfloat16_esql_and_semantic_text_tests' of github.com:mr…
mromaios a0e111e
[CI] Auto commit changes from spotless
cd2d7ba
Merge branch 'bfloat16_esql_and_semantic_text_tests' of github.com:mr…
mromaios eab02c9
revert changes to semantic_text
mromaios 139a89b
update csv values
mromaios 6eaa71b
Updated javadoc
Mikep86 7a086a6
Remove unnecessary commented out tests
Mikep86 06adfaa
Update analyzer tests
Mikep86 60a8c74
Make dense vector data sets private
Mikep86 d816446
Merge branch 'main' into bfloat16_esql_and_semantic_text_tests
Mikep86 e254da6
Update analyzer tests to use a dedicated dense vector mapping file
Mikep86 553897c
Merge branch 'main' into bfloat16_esql_and_semantic_text_tests
Mikep86 05a3568
Analyzer test adjustments
Mikep86 c9d553f
Updated VectorSimilarityFunctionsIT to test BFLOAT16
Mikep86 e4ef570
Updated VectorSimilarityFunction to handle BFLOAT16
Mikep86 3dbac87
Update docs/changelog/139113.yaml
mromaios 4c7654c
Update changelog
Mikep86 2cf7c59
Refactor field property checks in CsvTestsDataLoader
Mikep86 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
8 changes: 4 additions & 4 deletions
8
x-pack/plugin/esql/qa/testFixtures/src/main/resources/data/dense_vector.csv
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| id:l, float_vector:dense_vector, byte_vector:dense_vector, bit_vector:dense_vector | ||
| 0, [1.0, 2.0, 3.0], [10, 20, 30], [13, 112] | ||
| 1, [4.0, 5.0, 6.0], [40, 50, 60], [45, 9] | ||
| 2, [9.0, 8.0, 7.0], [90, 80, 70], [127, 0] | ||
| 3, [0.054, 0.032, 0.012], [100, 110, 120], [88, 53] | ||
| 0, [1.0, 2.0, 3.0], [10, 20, 30], [13, 112] | ||
| 1, [4.0, 5.0, 6.0], [40, 50, 60], [45, 9] | ||
| 2, [9.0, 8.0, 7.0], [90, 80, 70], [127, 0] | ||
| 3, [0.054, 0.032, 0.012], [100, 110, 120], [88, 53] |
5 changes: 5 additions & 0 deletions
5
x-pack/plugin/esql/qa/testFixtures/src/main/resources/data/dense_vector_bfloat16.csv
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| id:l, bfloat16_vector:dense_vector | ||
| 0, [1.0, 2.0, 3.0] | ||
| 1, [4.0, 5.0, 6.0] | ||
| 2, [9.0, 8.0, 7.0] | ||
| 3, [0.5390625, 0.3203125, 0.01202392578125] |
54 changes: 54 additions & 0 deletions
54
x-pack/plugin/esql/qa/testFixtures/src/main/resources/dense_vector-bfloat16.csv-spec
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| retrieveDenseBFloat16VectorData | ||
| required_capability: dense_vector_field_type_released | ||
| required_capability: dense_vector_agg_metric_double_if_version | ||
| required_capability: l2_norm_vector_similarity_function | ||
| required_capability: generic_vector_format | ||
|
|
||
| FROM dense_vector_bfloat16 | ||
| | KEEP id, bfloat16_vector | ||
| | SORT id | ||
| ; | ||
|
|
||
| id:l | bfloat16_vector:dense_vector | ||
| 0 | [1.0, 2.0, 3.0] | ||
| 1 | [4.0, 5.0, 6.0] | ||
| 2 | [9.0, 8.0, 7.0] | ||
| 3 | [0.5390625, 0.3203125, 0.01202392578125] | ||
| ; | ||
|
|
||
| denseBFloat16VectorWithEval | ||
| required_capability: dense_vector_agg_metric_double_if_version | ||
| required_capability: l2_norm_vector_similarity_function | ||
| required_capability: generic_vector_format | ||
|
|
||
| FROM dense_vector_bfloat16 | ||
| | EVAL v = bfloat16_vector | ||
| | KEEP id, v | ||
| | SORT id | ||
| ; | ||
|
|
||
| id:l | v:dense_vector | ||
| 0 | [1.0, 2.0, 3.0] | ||
| 1 | [4.0, 5.0, 6.0] | ||
| 2 | [9.0, 8.0, 7.0] | ||
| 3 | [0.5390625, 0.3203125, 0.01202392578125] | ||
| ; | ||
|
|
||
| denseBFloat16VectorWithRenameAndDrop | ||
| required_capability: dense_vector_agg_metric_double_if_version | ||
| required_capability: l2_norm_vector_similarity_function | ||
| required_capability: generic_vector_format | ||
|
|
||
| FROM dense_vector_bfloat16 | ||
| | EVAL v = bfloat16_vector | ||
| | RENAME v AS new_vector | ||
| | DROP bfloat16_vector | ||
| | SORT id | ||
| ; | ||
|
|
||
| id:l | new_vector:dense_vector | ||
| 0 | [1.0, 2.0, 3.0] | ||
| 1 | [4.0, 5.0, 6.0] | ||
| 2 | [9.0, 8.0, 7.0] | ||
| 3 | [0.5390625, 0.3203125, 0.01202392578125] | ||
| ; |
48 changes: 48 additions & 0 deletions
48
...lugin/esql/qa/testFixtures/src/main/resources/mapping-dense_vector-all_element_types.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| { | ||
| "properties": { | ||
| "id": { | ||
| "type": "long" | ||
| }, | ||
| "float_vector": { | ||
| "type": "dense_vector", | ||
| "similarity": "l2_norm", | ||
| "index_options": { | ||
| "type": "hnsw", | ||
| "m": 16, | ||
| "ef_construction": 100 | ||
| } | ||
| }, | ||
| "byte_vector": { | ||
| "type": "dense_vector", | ||
| "similarity": "l2_norm", | ||
| "element_type": "byte", | ||
| "index_options": { | ||
| "type": "hnsw", | ||
| "m": 16, | ||
| "ef_construction": 100 | ||
| } | ||
| }, | ||
| "bit_vector": { | ||
| "type": "dense_vector", | ||
| "dims": 16, | ||
| "similarity": "l2_norm", | ||
| "element_type": "bit", | ||
| "index_options": { | ||
| "type": "hnsw", | ||
| "m": 16, | ||
| "ef_construction": 100 | ||
| } | ||
| }, | ||
| "bfloat16_vector": { | ||
| "type": "dense_vector", | ||
| "dims": 16, | ||
| "similarity": "l2_norm", | ||
| "element_type": "bfloat16", | ||
| "index_options": { | ||
| "type": "hnsw", | ||
| "m": 16, | ||
| "ef_construction": 100 | ||
| } | ||
| } | ||
| } | ||
| } |
17 changes: 17 additions & 0 deletions
17
x-pack/plugin/esql/qa/testFixtures/src/main/resources/mapping-dense_vector_bfloat16.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "properties": { | ||
| "id": { | ||
| "type": "long" | ||
| }, | ||
| "bfloat16_vector": { | ||
| "type": "dense_vector", | ||
| "similarity": "l2_norm", | ||
| "element_type": "bfloat16", | ||
| "index_options": { | ||
| "type": "hnsw", | ||
| "m": 16, | ||
| "ef_construction": 100 | ||
| } | ||
| } | ||
| } | ||
| } |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.