Skip to content

Commit 3a83a70

Browse files
author
elasticsearchmachine
committed
Fix tests
1 parent e8c325b commit 3a83a70

File tree

7 files changed

+153
-217
lines changed

7 files changed

+153
-217
lines changed
Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
1-
color:text,hex_code:keyword,rgb_vector:dense_vector,primary:boolean
2-
maroon, #800000, [128,0,0], false
3-
brown, #A52A2A, [165,42,42], false
4-
firebrick, #B22222, [178,34,34], false
5-
crimson, #DC143C, [220,20,60], false
6-
red, #FF0000, [255,0,0], true
7-
tomato, #FF6347, [255,99,71], false
8-
coral, #FF7F50, [255,127,80], false
9-
salmon, #FA8072, [250,128,114], false
10-
orange, #FFA500, [255,165,0], false
11-
gold, #FFD700, [255,215,0], false
12-
golden rod, #DAA520, [218,165,32], false
13-
khaki, #F0E68C, [240,230,140], false
14-
olive, #808000, [128,128,0], false
15-
yellow, #FFFF00, [255,255,0], true
16-
chartreuse, #7FFF00, [127,255,0], false
17-
green, #008000, [0,128,0], true
18-
lime, #00FF00, [0,255,0], false
19-
teal, #008080, [0,128,128], false
20-
cyan, #00FFFF, [0,255,255], true
21-
turquoise, #40E0D0, [64,224,208], false
22-
aqua marine, #7FFFD4, [127,255,212], false
23-
navy, #000080, [0,0,128], false
24-
blue, #0000FF, [0,0,255], true
25-
indigo, #4B0082, [75,0,130], false
26-
purple, #800080, [128,0,128], false
27-
thistle, #D8BFD8, [216,191,216], false
28-
plum, #DDA0DD, [221,160,221], false
29-
violet, #EE82EE, [238,130,238], false
30-
magenta, #FF00FF, [255,0,255], true
31-
orchid, #DA70D6, [218,112,214], false
32-
pink, #FFC0CB, [255,192,203], false
33-
beige, #F5F5DC, [245,245,220], false
34-
bisque, #FFE4C4, [255,228,196], false
35-
wheat, #F5DEB3, [245,222,179], false
36-
corn silk, #FFF8DC, [255,248,220], false
37-
lemon chiffon, #FFFACD, [255,250,205], false
38-
sienna, #A0522D, [160,82,45], false
39-
chocolate, #D2691E, [210,105,30], false
40-
peru, #CD853F, [205,133,63], false
41-
burly wood, #DEB887, [222,184,135], false
42-
tan, #D2B48C, [210,180,140], false
43-
moccasin, #FFE4B5, [255,228,181], false
44-
peach puff, #FFDAB9, [255,218,185], false
45-
misty rose, #FFE4E1, [255,228,225], false
46-
linen, #FAF0E6, [250,240,230], false
47-
old lace, #FDF5E6, [253,245,230], false
48-
papaya whip, #FFEFD5, [255,239,213], false
49-
sea shell, #FFF5EE, [255,245,238], false
50-
mint cream, #F5FFFA, [245,255,250], false
51-
lavender, #E6E6FA, [230,230,250], false
52-
honeydew, #F0FFF0, [240,255,240], false
53-
ivory, #FFFFF0, [255,255,240], false
54-
azure, #F0FFFF, [240,255,255], false
55-
snow, #FFFAFA, [255,250,250], false
56-
black, #000000, [0,0,0], true
57-
gray, #808080, [128,128,128], true
58-
silver, #C0C0C0, [192,192,192], false
59-
gainsboro, #DCDCDC, [220,220,220], false
60-
white, #FFFFFF, [255,255,255], true
1+
color:text,hex_code:keyword,rgb_vector:dense_vector,rgb_byte_vector:dense_vector,primary:boolean
2+
maroon, #800000, [128,0,0], [0, -128, -128], false
3+
brown, #A52A2A, [165,42,42], [37, -86, -86], false
4+
firebrick, #B22222, [178,34,34], [50, -94, -94], false
5+
crimson, #DC143C, [220,20,60], [92, -108, -68], false
6+
red, #FF0000, [255,0,0], [127, -128, -128], true
7+
tomato, #FF6347, [255,99,71], [127, -29, -57], false
8+
coral, #FF7F50, [255,127,80], [127, -1, -48], false
9+
salmon, #FA8072, [250,128,114], [122, 0, -14], false
10+
orange, #FFA500, [255,165,0], [127, 37, -128], false
11+
gold, #FFD700, [255,215,0], [127, 87, -128], false
12+
golden rod, #DAA520, [218,165,32], [90, 37, -96], false
13+
khaki, #F0E68C, [240,230,140], [112, 102, 12], false
14+
olive, #808000, [128,128,0], [0, 0, -128], false
15+
yellow, #FFFF00, [255,255,0], [127, 127, -128], true
16+
chartreuse, #7FFF00, [127,255,0], [-1, 127, -128], false
17+
green, #008000, [0,128,0], [-128, 0, -128], true
18+
lime, #00FF00, [0,255,0], [-128, 127, -128], false
19+
teal, #008080, [0,128,128], [0, 0, -128], false
20+
cyan, #00FFFF, [0,255,255], [127, 127, -128], true
21+
turquoise, #40E0D0, [64,224,208], [-64, 96, 80], false
22+
aqua marine, #7FFFD4, [127,255,212], [-1, 127, 84], false
23+
navy, #000080, [0,0,128], [-128, -128, 0], false
24+
blue, #0000FF, [0,0,255], [-128, -128, 127], true
25+
indigo, #4B0082, [75,0,130], [-53, -128, 2], false
26+
purple, #800080, [128,0,128], [0, -128, 0], false
27+
thistle, #D8BFD8, [216,191,216], [88, 63, 88], false
28+
plum, #DDA0DD, [221,160,221], [93, 32, 93], false
29+
violet, #EE82EE, [238,130,238], [110, 2, 110], false
30+
magenta, #FF00FF, [255,0,255], [127, -128, 127], true
31+
orchid, #DA70D6, [218,112,214], [90, -16, 86], false
32+
pink, #FFC0CB, [255,192,203], [127, 64, 75], false
33+
beige, #F5F5DC, [245,245,220], [117, 117, 92], false
34+
bisque, #FFE4C4, [255,228,196], [127, 100, 68], false
35+
wheat, #F5DEB3, [245,222,179], [117, 94, 51], false
36+
corn silk, #FFF8DC, [255,248,220], [127, 120, 92], false
37+
lemon chiffon, #FFFACD, [255,250,205], [127, 122, 77], false
38+
sienna, #A0522D, [160,82,45], [32, -46, -83], false
39+
chocolate, #D2691E, [210,105,30], [82, -23, -98], false
40+
peru, #CD853F, [205,133,63], [77, 5, -65], false
41+
burly wood, #DEB887, [222,184,135], [94, 56, 7], false
42+
tan, #D2B48C, [210,180,140], [82, 52, 12], false
43+
moccasin, #FFE4B5, [255,228,181], [127, 100, 53], false
44+
peach puff, #FFDAB9, [255,218,185], [127, 90, 57], false
45+
misty rose, #FFE4E1, [255,228,225], [127, 100, 97], false
46+
linen, #FAF0E6, [250,240,230], [122, 112, 102], false
47+
old lace, #FDF5E6, [253,245,230], [125, 117, 102], false
48+
papaya whip, #FFEFD5, [255,239,213], [127, 111, 85], false
49+
sea shell, #FFF5EE, [255,245,238], [127, 117, 110], false
50+
mint cream, #F5FFFA, [245,255,250], [117, 127, 122], false
51+
lavender, #E6E6FA, [230,230,250], [102, 102, 122], false
52+
honeydew, #F0FFF0, [240,255,240], [112, 127, 112], false
53+
ivory, #FFFFF0, [255,255,240], [127, 127, 112], false
54+
azure, #F0FFFF, [240,255,255], [112, 127, 127], false
55+
snow, #FFFAFA, [255,250,250], [127, 122, 122], false
56+
black, #000000, [0,0,0], [-128, -128, -128], true
57+
gray, #808080, [128,128,128], [0, 0, 0], true
58+
silver, #C0C0C0, [192,192,192], [64, 64, 64], false
59+
gainsboro, #DCDCDC, [220,220,220], [92, 92, 92], false
60+
white, #FFFFFF, [255,255,255], [127, 127, 127], true

x-pack/plugin/esql/qa/testFixtures/src/main/resources/mapping-colors.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
"m": 16,
1818
"ef_construction": 100
1919
}
20+
},
21+
"rgb_byte_vector": {
22+
"type": "dense_vector",
23+
"similarity": "l2_norm",
24+
"element_type": "byte",
25+
"index_options": {
26+
"type": "hnsw",
27+
"m": 16,
28+
"ef_construction": 100
29+
}
2030
}
2131
}
2232
}

x-pack/plugin/esql/qa/testFixtures/src/main/resources/vector-cosine-similarity.csv-spec

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
;
1616

1717
// tag::vector-cosine-similarity-result[]
18-
color:text | similarity:double
19-
cyan | 1.0
20-
teal | 1.0
21-
turquoise | 0.9890533685684204
22-
aqua marine | 0.964962363243103
23-
azure | 0.916246771812439
24-
lavender | 0.9136701822280884
25-
mint cream | 0.9122757911682129
26-
honeydew | 0.9122424125671387
27-
gainsboro | 0.9082483053207397
28-
gray | 0.9082483053207397
18+
color:text | similarity:double
19+
cyan | 1.0
20+
teal | 1.0
21+
turquoise | 0.9781067967414856
22+
aqua marine | 0.929924726486206
23+
azure | 0.8324936032295227
24+
lavender | 0.827340304851532
25+
mint cream | 0.8245516419410706
26+
honeydew | 0.8244848847389221
27+
gainsboro | 0.8164966106414795
28+
gray | 0.8164966106414795
2929
// end::vector-cosine-similarity-result[]
3030
;
3131

@@ -107,30 +107,3 @@ row vector = to_dense_vector([1, 2, 3])
107107
vector:dense_vector | similarity:double
108108
[1.0, 2.0, 3.0] | 0.956
109109
;
110-
111-
similarityWithVectorField
112-
required_capability: cosine_vector_similarity_function
113-
required_capability: to_dense_vector_function
114-
required_capability: dense_vector_field_type_released
115-
116-
from colors
117-
| where color != "black"
118-
| eval query = to_dense_vector([0, 255, 255])
119-
| eval similarity = v_cosine(rgb_vector, query)
120-
| sort similarity desc, color asc
121-
| limit 10
122-
| keep color, similarity
123-
;
124-
125-
color:text | similarity:double
126-
cyan | 1.0
127-
teal | 1.0
128-
turquoise | 0.9781067967414856
129-
aqua marine | 0.929924726486206
130-
azure | 0.8324936032295227
131-
lavender | 0.827340304851532
132-
mint cream | 0.8245516419410706
133-
honeydew | 0.8244848847389221
134-
gainsboro | 0.8164966106414795
135-
gray | 0.8164966106414795
136-
;

x-pack/plugin/esql/qa/testFixtures/src/main/resources/vector-dot-product.csv-spec

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515

1616
// tag::vector-dot-product-result[]
1717
color:text | similarity:double
18-
azure | 65025.5
19-
cyan | 65025.5
20-
white | 65025.5
21-
mint cream | 64388.0
22-
snow | 63750.5
23-
honeydew | 63113.0
24-
ivory | 63113.0
25-
sea shell | 61583.0
26-
lavender | 61200.5
27-
old lace | 60563.0
18+
azure | 130050.0
19+
cyan | 130050.0
20+
white | 130050.0
21+
mint cream | 128775.0
22+
snow | 127500.0
23+
honeydew | 126225.0
24+
ivory | 126225.0
25+
sea shell | 123165.0
26+
lavender | 122400.0
27+
old lace | 121125.0
2828
// end::vector-dot-product-result[]
2929
;
3030

x-pack/plugin/esql/qa/testFixtures/src/main/resources/vector-hamming.csv-spec

Lines changed: 25 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
// tag::vector-hamming[]
88
from colors
9-
| eval similarity = v_hamming(rgb_vector, [0, 255, 255])
9+
| eval similarity = v_hamming(rgb_byte_vector, [0, 127, 127])
1010
| sort similarity desc, color asc
1111
// end::vector-hamming[]
1212
| limit 10
@@ -15,16 +15,16 @@
1515

1616
// tag::vector-hamming-result[]
1717
color:text | similarity:double
18-
red | 24.0
19-
orange | 20.0
20-
gold | 18.0
21-
indigo | 18.0
22-
bisque | 17.0
23-
maroon | 17.0
24-
pink | 17.0
25-
salmon | 17.0
26-
black | 16.0
27-
firebrick | 16.0
18+
red | 23.0
19+
indigo | 19.0
20+
orange | 19.0
21+
black | 17.0
22+
gold | 17.0
23+
chartreuse | 16.0
24+
green | 16.0
25+
maroon | 16.0
26+
navy | 16.0
27+
salmon | 16.0
2828
// end::vector-hamming-result[]
2929
;
3030

@@ -33,23 +33,23 @@ required_capability: hamming_vector_similarity_function
3333
required_capability: dense_vector_field_type_released
3434

3535
from colors
36-
| eval score = round((1 + v_hamming(rgb_vector, [0, 255, 255]) / 2), 3)
36+
| eval score = round((1 + v_hamming(rgb_byte_vector, [0, 127, 127]) / 2), 3)
3737
| sort score desc, color asc
3838
| limit 10
3939
| keep color, score
4040
;
4141

4242
color:text | score:double
43-
red | 13.0
44-
orange | 11.0
45-
gold | 10.0
46-
indigo | 10.0
47-
bisque | 9.5
48-
maroon | 9.5
49-
pink | 9.5
50-
salmon | 9.5
51-
black | 9.0
52-
firebrick | 9.0
43+
red | 12.5
44+
indigo | 10.5
45+
orange | 10.5
46+
black | 9.5
47+
gold | 9.5
48+
bisque | 9.0
49+
chartreuse | 9.0
50+
green | 9.0
51+
maroon | 9.0
52+
navy | 9.0
5353
;
5454

5555
similarityWithLiteralVectors
@@ -70,12 +70,12 @@ required_capability: hamming_vector_similarity_function
7070
required_capability: dense_vector_field_type_released
7171

7272
from colors
73-
| eval similarity = round(v_hamming(rgb_vector, [0, 255, 255]), 3)
73+
| eval similarity = round(v_hamming(rgb_byte_vector, [0, 127, 127]), 3)
7474
| stats avg = round(avg(similarity), 3), min = min(similarity), max = max(similarity)
7575
;
7676

7777
avg:double | min:double | max:double
78-
13.322 | 0.0 | 24.0
78+
12.932 | 3.0 | 23.0
7979
;
8080

8181
similarityWithNull
@@ -84,7 +84,7 @@ required_capability: vector_similarity_functions_support_null
8484
required_capability: dense_vector_field_type_released
8585

8686
from colors
87-
| eval similarity = v_hamming(rgb_vector, null)
87+
| eval similarity = v_hamming(rgb_byte_vector, null)
8888
| stats total_null = count(*) where similarity is null
8989
;
9090

@@ -105,28 +105,3 @@ vector: dense_vector | similarity:double
105105
[1.0, 2.0, 3.0] | 4.0
106106
;
107107

108-
similarityWithVectorField
109-
required_capability: hamming_vector_similarity_function
110-
required_capability: to_dense_vector_function
111-
required_capability: dense_vector_field_type_released
112-
113-
from colors
114-
| eval query = to_dense_vector([0, 255, 255])
115-
| eval similarity = v_hamming(rgb_vector, query)
116-
| sort similarity desc, color asc
117-
| limit 10
118-
| keep color, similarity
119-
;
120-
121-
color:text | similarity:double
122-
red | 24.0
123-
orange | 20.0
124-
gold | 18.0
125-
indigo | 18.0
126-
bisque | 17.0
127-
maroon | 17.0
128-
pink | 17.0
129-
salmon | 17.0
130-
black | 16.0
131-
firebrick | 16.0
132-
;

0 commit comments

Comments
 (0)