forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding new bbq index types behind a feature flag
- Loading branch information
Showing
8 changed files
with
543 additions
and
19 deletions.
There are no files selected for viewing
144 changes: 144 additions & 0 deletions
144
...c/src/yamlRestTest/resources/rest-api-spec/test/search.vectors/41_knn_search_bbq_hnsw.yml
This file contains 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,144 @@ | ||
setup: | ||
- requires: | ||
cluster_features: "mapper.vectors.bbq" | ||
reason: 'kNN float to better-binary quantization is required' | ||
- do: | ||
indices.create: | ||
index: bbq_hnsw | ||
body: | ||
settings: | ||
index: | ||
number_of_shards: 1 | ||
mappings: | ||
properties: | ||
name: | ||
type: keyword | ||
vector: | ||
type: dense_vector | ||
dims: 65 | ||
index: true | ||
similarity: l2_norm | ||
index_options: | ||
type: bbq_hnsw | ||
another_vector: | ||
type: dense_vector | ||
dims: 65 | ||
index: true | ||
similarity: l2_norm | ||
index_options: | ||
type: bbq_hnsw | ||
|
||
- do: | ||
index: | ||
index: bbq_hnsw | ||
id: "1" | ||
body: | ||
name: cow.jpg | ||
vector: [230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0] | ||
another_vector: [130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0] | ||
# Flush in order to provoke a merge later | ||
- do: | ||
indices.flush: | ||
index: bbq_hnsw | ||
|
||
- do: | ||
index: | ||
index: bbq_hnsw | ||
id: "2" | ||
body: | ||
name: moose.jpg | ||
vector: [-0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0] | ||
another_vector: [-0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120] | ||
# Flush in order to provoke a merge later | ||
- do: | ||
indices.flush: | ||
index: bbq_hnsw | ||
|
||
- do: | ||
index: | ||
index: bbq_hnsw | ||
id: "3" | ||
body: | ||
name: rabbit.jpg | ||
vector: [0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0] | ||
another_vector: [-0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0] | ||
# Flush in order to provoke a merge later | ||
- do: | ||
indices.flush: | ||
index: bbq_hnsw | ||
|
||
- do: | ||
indices.forcemerge: | ||
index: bbq_hnsw | ||
max_num_segments: 1 | ||
--- | ||
"Test bad quantization parameters": | ||
- do: | ||
catch: bad_request | ||
indices.create: | ||
index: bad_bbq_hnsw | ||
body: | ||
mappings: | ||
properties: | ||
vector: | ||
type: dense_vector | ||
dims: 64 | ||
element_type: byte | ||
index: true | ||
index_options: | ||
type: bbq_hnsw | ||
|
||
- do: | ||
catch: bad_request | ||
indices.create: | ||
index: bad_bbq_hnsw | ||
body: | ||
mappings: | ||
properties: | ||
vector: | ||
type: dense_vector | ||
dims: 64 | ||
index: false | ||
index_options: | ||
type: bbq_hnsw | ||
--- | ||
"Test few dimensions fail indexing": | ||
- do: | ||
catch: bad_request | ||
indices.create: | ||
index: bad_bbq_hnsw | ||
body: | ||
mappings: | ||
properties: | ||
vector: | ||
type: dense_vector | ||
dims: 42 | ||
index: true | ||
index_options: | ||
type: bbq_hnsw | ||
|
||
- do: | ||
indices.create: | ||
index: dynamic_dim_bbq_hnsw | ||
body: | ||
mappings: | ||
properties: | ||
vector: | ||
type: dense_vector | ||
index: true | ||
similarity: l2_norm | ||
index_options: | ||
type: bbq_hnsw | ||
|
||
- do: | ||
catch: bad_request | ||
index: | ||
index: dynamic_dim_bbq_hnsw | ||
body: | ||
vector: [1.0, 2.0, 3.0, 4.0, 5.0] | ||
|
||
- do: | ||
index: | ||
index: dynamic_dim_bbq_hnsw | ||
body: | ||
vector: [1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0] |
150 changes: 150 additions & 0 deletions
150
...c/src/yamlRestTest/resources/rest-api-spec/test/search.vectors/42_knn_search_bbq_flat.yml
This file contains 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,150 @@ | ||
setup: | ||
- requires: | ||
cluster_features: "mapper.vectors.bbq" | ||
reason: 'kNN float to better-binary quantization is required' | ||
- do: | ||
indices.create: | ||
index: bbq_flat | ||
body: | ||
settings: | ||
index: | ||
number_of_shards: 1 | ||
mappings: | ||
properties: | ||
name: | ||
type: keyword | ||
vector: | ||
type: dense_vector | ||
dims: 65 | ||
index: true | ||
similarity: l2_norm | ||
index_options: | ||
type: bbq_flat | ||
another_vector: | ||
type: dense_vector | ||
dims: 65 | ||
index: true | ||
similarity: l2_norm | ||
index_options: | ||
type: bbq_flat | ||
|
||
- do: | ||
index: | ||
index: bbq_flat | ||
id: "1" | ||
body: | ||
name: cow.jpg | ||
vector: [230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0, 230.0, 300.33, -34.8988, 15.555, -200.0] | ||
another_vector: [130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0, 130.0, 115.0, -1.02, 15.555, -100.0] | ||
# Flush in order to provoke a merge later | ||
- do: | ||
indices.flush: | ||
index: bbq_flat | ||
|
||
- do: | ||
index: | ||
index: bbq_flat | ||
id: "2" | ||
body: | ||
name: moose.jpg | ||
vector: [-0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0, -0.5, 100.0, -13, 14.8, -156.0] | ||
another_vector: [-0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120, -0.5, 50.0, -1, 1, 120] | ||
# Flush in order to provoke a merge later | ||
- do: | ||
indices.flush: | ||
index: bbq_flat | ||
|
||
- do: | ||
index: | ||
index: bbq_flat | ||
id: "3" | ||
body: | ||
name: rabbit.jpg | ||
vector: [0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0, 0.5, 111.3, -13.0, 14.8, -156.0] | ||
another_vector: [-0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0, -0.5, 11.0, 0, 12, 111.0] | ||
# Flush in order to provoke a merge later | ||
- do: | ||
indices.flush: | ||
index: bbq_flat | ||
|
||
- do: | ||
indices.forcemerge: | ||
index: bbq_flat | ||
max_num_segments: 1 | ||
--- | ||
"Test bad parameters": | ||
- do: | ||
catch: bad_request | ||
indices.create: | ||
index: bad_bbq_flat | ||
body: | ||
mappings: | ||
properties: | ||
vector: | ||
type: dense_vector | ||
dims: 64 | ||
index: true | ||
index_options: | ||
type: bbq_flat | ||
m: 42 | ||
|
||
- do: | ||
catch: bad_request | ||
indices.create: | ||
index: bad_bbq_flat | ||
body: | ||
mappings: | ||
properties: | ||
vector: | ||
type: dense_vector | ||
dims: 64 | ||
element_type: byte | ||
index: true | ||
index_options: | ||
type: bbq_flat | ||
--- | ||
"Test few dimensions fail indexing": | ||
# verify index creation fails | ||
- do: | ||
catch: bad_request | ||
indices.create: | ||
index: bad_bbq_flat | ||
body: | ||
mappings: | ||
properties: | ||
vector: | ||
type: dense_vector | ||
dims: 42 | ||
index: true | ||
similarity: l2_norm | ||
index_options: | ||
type: bbq_flat | ||
|
||
# verify dynamic dimension fails | ||
- do: | ||
indices.create: | ||
index: dynamic_dim_bbq_flat | ||
body: | ||
mappings: | ||
properties: | ||
vector: | ||
type: dense_vector | ||
index: true | ||
similarity: l2_norm | ||
index_options: | ||
type: bbq_flat | ||
|
||
# verify index fails for odd dim vector | ||
- do: | ||
catch: bad_request | ||
index: | ||
index: dynamic_dim_bbq_flat | ||
body: | ||
vector: [1.0, 2.0, 3.0, 4.0, 5.0] | ||
|
||
# verify that we can index an even dim vector after the odd dim vector failure | ||
- do: | ||
index: | ||
index: dynamic_dim_bbq_flat | ||
body: | ||
vector: [1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0] |
This file contains 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 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.