Skip to content

Commit d7b212b

Browse files
authored
Merge branch 'main' into pr-benchmarks
2 parents eac1b07 + 3b62845 commit d7b212b

File tree

8 files changed

+228
-188
lines changed

8 files changed

+228
-188
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,6 @@ tests:
501501
- class: org.elasticsearch.repositories.SnapshotMetricsIT
502502
method: testSnapshotAPMMetrics
503503
issue: https://github.com/elastic/elasticsearch/issues/132731
504-
- class: org.elasticsearch.index.codec.vectors.cluster.HierarchicalKMeansTests
505-
method: testHKmeans
506-
issue: https://github.com/elastic/elasticsearch/issues/132771
507504
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeForkIT
508505
method: test {csv-spec:lookup-join.MvJoinKeyFromRowExpanded}
509506
issue: https://github.com/elastic/elasticsearch/issues/132778

server/src/test/java/org/elasticsearch/index/codec/vectors/cluster/HierarchicalKMeansTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ public void testHKmeans() throws IOException {
4646
assertEquals(nVectors, soarAssignments.length);
4747
// verify no duplicates exist
4848
for (int i = 0; i < assignments.length; i++) {
49-
assertTrue(soarAssignments[i] >= 0 && soarAssignments[i] < centroids.length);
50-
assertNotEquals(assignments[i], soarAssignments[i]);
49+
int soarAssignment = soarAssignments[i];
50+
assertTrue(soarAssignment == -1 || (soarAssignment >= 0 && soarAssignment < centroids.length));
51+
assertNotEquals(assignments[i], soarAssignment);
5152
}
5253
} else {
5354
assertEquals(0, soarAssignments.length);

server/src/test/java/org/elasticsearch/index/mapper/vectors/SparseVectorFieldMapperTests.java

Lines changed: 146 additions & 167 deletions
Large diffs are not rendered by default.

x-pack/plugin/esql/qa/testFixtures/src/main/resources/knn-function.csv-spec

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ yellow | [255.0, 255.0, 0.0]
7070
knnWithPrefilter
7171
required_capability: knn_function_v3
7272

73-
from colors metadata _score
74-
| where knn(rgb_vector, [128,128,0], 10) and (match(color, "olive") or match(color, "green"))
75-
| sort _score desc, color asc
76-
| keep color, rgb_vector
73+
from colors
74+
| where knn(rgb_vector, [120,180,0], 10) and (match(color, "olive") or match(color, "green"))
75+
| sort color asc
76+
| keep color
7777
;
7878

79-
color:text | rgb_vector:dense_vector
80-
olive | [128.0, 128.0, 0.0]
81-
green | [0.0, 128.0, 0.0]
79+
color:text
80+
green
81+
olive
8282
;
8383

8484
knnWithNegatedPrefilter

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/session/FieldNameUtilsTests.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,6 +2243,8 @@ public void testForkRef4() {
22432243
}
22442244

22452245
public void testRerankerAfterFuse() {
2246+
assumeTrue("FUSE required", EsqlCapabilities.Cap.FUSE.isEnabled());
2247+
assertTrue("FORK required", EsqlCapabilities.Cap.FORK_V9.isEnabled());
22462248
assertFieldNames("""
22472249
FROM books METADATA _id, _index, _score
22482250
| FORK ( WHERE title:"Tolkien" | SORT _score, _id DESC | LIMIT 3 )
@@ -2256,6 +2258,8 @@ public void testRerankerAfterFuse() {
22562258
}
22572259

22582260
public void testSimpleFuse() {
2261+
assumeTrue("FUSE required", EsqlCapabilities.Cap.FUSE.isEnabled());
2262+
assertTrue("FORK required", EsqlCapabilities.Cap.FORK_V9.isEnabled());
22592263
assertFieldNames("""
22602264
FROM employees METADATA _id, _index, _score
22612265
| FORK ( WHERE emp_no:10001 )
@@ -2267,6 +2271,8 @@ public void testSimpleFuse() {
22672271
}
22682272

22692273
public void testFuseWithMatchAndScore() {
2274+
assumeTrue("FUSE required", EsqlCapabilities.Cap.FUSE.isEnabled());
2275+
assertTrue("FORK required", EsqlCapabilities.Cap.FORK_V9.isEnabled());
22702276
assertFieldNames("""
22712277
FROM books METADATA _id, _index, _score
22722278
| FORK ( WHERE title:"Tolkien" | SORT _score, _id DESC | LIMIT 3 )
@@ -2279,6 +2285,8 @@ public void testFuseWithMatchAndScore() {
22792285
}
22802286

22812287
public void testFuseWithDisjunctionAndPostFilter() {
2288+
assumeTrue("FUSE required", EsqlCapabilities.Cap.FUSE.isEnabled());
2289+
assertTrue("FORK required", EsqlCapabilities.Cap.FORK_V9.isEnabled());
22822290
assertFieldNames("""
22832291
FROM books METADATA _id, _index, _score
22842292
| FORK ( WHERE title:"Tolkien" OR author:"Tolkien" | SORT _score, _id DESC | LIMIT 3 )
@@ -2292,6 +2300,8 @@ public void testFuseWithDisjunctionAndPostFilter() {
22922300
}
22932301

22942302
public void testFuseWithStats() {
2303+
assumeTrue("FUSE required", EsqlCapabilities.Cap.FUSE.isEnabled());
2304+
assertTrue("FORK required", EsqlCapabilities.Cap.FORK_V9.isEnabled());
22952305
assertFieldNames("""
22962306
FROM books METADATA _id, _index, _score
22972307
| FORK ( WHERE title:"Tolkien" | SORT _score, _id DESC | LIMIT 3 )
@@ -2303,6 +2313,8 @@ public void testFuseWithStats() {
23032313
}
23042314

23052315
public void testFuseWithMultipleForkBranches() {
2316+
assumeTrue("FUSE required", EsqlCapabilities.Cap.FUSE.isEnabled());
2317+
assertTrue("FORK required", EsqlCapabilities.Cap.FORK_V9.isEnabled());
23062318
assertFieldNames("""
23072319
FROM books METADATA _id, _index, _score
23082320
| FORK (WHERE author:"Keith Faulkner" AND qstr("author:Rory or author:Beverlie") | SORT _score, _id DESC | LIMIT 3)
@@ -2318,6 +2330,8 @@ public void testFuseWithMultipleForkBranches() {
23182330
}
23192331

23202332
public void testFuseWithSemanticSearch() {
2333+
assumeTrue("FUSE required", EsqlCapabilities.Cap.FUSE.isEnabled());
2334+
assertTrue("FORK required", EsqlCapabilities.Cap.FORK_V9.isEnabled());
23212335
assertFieldNames("""
23222336
FROM semantic_text METADATA _id, _score, _index
23232337
| FORK ( WHERE semantic_text_field:"something" | SORT _score DESC | LIMIT 2)
@@ -2503,6 +2517,8 @@ public void testForkWithUnsupportedAttributes() {
25032517
}
25042518

25052519
public void testForkAfterLookupJoin() {
2520+
assumeTrue("LOOKUP JOIN available as snapshot only", EsqlCapabilities.Cap.JOIN_LOOKUP_V12.isEnabled());
2521+
assertTrue("FORK required", EsqlCapabilities.Cap.FORK_V9.isEnabled());
25062522
assertFieldNames(
25072523
"""
25082524
FROM employees
@@ -2529,6 +2545,8 @@ public void testForkAfterLookupJoin() {
25292545
}
25302546

25312547
public void testForkBeforeLookupJoin() {
2548+
assumeTrue("LOOKUP JOIN available as snapshot only", EsqlCapabilities.Cap.JOIN_LOOKUP_V12.isEnabled());
2549+
assertTrue("FORK required", EsqlCapabilities.Cap.FORK_V9.isEnabled());
25322550
assertFieldNames(
25332551
"""
25342552
FROM employees
@@ -2555,6 +2573,8 @@ public void testForkBeforeLookupJoin() {
25552573
}
25562574

25572575
public void testForkBranchWithLookupJoin() {
2576+
assumeTrue("LOOKUP JOIN available as snapshot only", EsqlCapabilities.Cap.JOIN_LOOKUP_V12.isEnabled());
2577+
assertTrue("FORK required", EsqlCapabilities.Cap.FORK_V9.isEnabled());
25582578
assertFieldNames(
25592579
"""
25602580
FROM employees
@@ -2826,6 +2846,8 @@ public void testForkAfterMvExpand() {
28262846
}
28272847

28282848
public void testForkBeforeInlineStatsIgnore() {
2849+
assumeTrue("INLINESTATS required", EsqlCapabilities.Cap.INLINESTATS_V9.isEnabled());
2850+
assertTrue("FORK required", EsqlCapabilities.Cap.FORK_V9.isEnabled());
28292851
assertFieldNames("""
28302852
FROM employees
28312853
| KEEP emp_no, languages, gender
@@ -2837,6 +2859,8 @@ public void testForkBeforeInlineStatsIgnore() {
28372859
}
28382860

28392861
public void testForkBranchWithInlineStatsIgnore() {
2862+
assumeTrue("INLINESTATS required", EsqlCapabilities.Cap.INLINESTATS_V9.isEnabled());
2863+
assertTrue("FORK required", EsqlCapabilities.Cap.FORK_V9.isEnabled());
28402864
assertFieldNames("""
28412865
FROM employees
28422866
| KEEP emp_no, languages, gender
@@ -2849,6 +2873,8 @@ public void testForkBranchWithInlineStatsIgnore() {
28492873
}
28502874

28512875
public void testForkAfterInlineStatsIgnore() {
2876+
assumeTrue("INLINESTATS required", EsqlCapabilities.Cap.INLINESTATS_V9.isEnabled());
2877+
assertTrue("FORK required", EsqlCapabilities.Cap.FORK_V9.isEnabled());
28522878
assertFieldNames("""
28532879
FROM employees
28542880
| KEEP emp_no, languages, gender

x-pack/plugin/ml/qa/multi-cluster-tests-with-security/src/test/resources/rest-api-spec/test/multi_cluster/50_sparse_vector.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ teardown:
622622
{"index": { "_id": "11" }}
623623
{"content_embedding":{"is": 0.6, "pugs": 0.6 }}
624624
{"index": { "_id": "12" }}
625-
{"content_embedding":{"is": 0.1891394, "pugs": 0.1 }}
625+
{"content_embedding":{"cats": 0.1 }}
626626
627627
- do:
628628
search:
@@ -633,13 +633,25 @@ teardown:
633633
field: content_embedding
634634
query_vector:
635635
pugs: 0.5
636-
cats: 0.5
637-
is: 0.04600334
636+
cats: 0.18
637+
is: 0.20
638638

639639
- match: { hits.total.value: 2 }
640640
- match: { hits.hits.0._id: "11" }
641641
- match: { hits.hits.1._id: "12" }
642642

643+
- do:
644+
search:
645+
index: test-sparse-vector-pruning-default
646+
body:
647+
query:
648+
sparse_vector:
649+
field: content_embedding
650+
query_vector:
651+
is: 0.21 # 0.2 is the weight threshold for the default pruning config
652+
653+
- match: { hits.total.value: 11 }
654+
643655
- do:
644656
search:
645657
index: test-sparse-vector-pruning-default

x-pack/plugin/ml/qa/multi-cluster-tests-with-security/src/test/resources/rest-api-spec/test/remote_cluster/50_sparse_vector.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ teardown:
620620
{"index": { "_id": "11" }}
621621
{"content_embedding":{"is": 0.6, "pugs": 0.6 }}
622622
{"index": { "_id": "12" }}
623-
{"content_embedding":{"is": 0.1891394, "pugs": 0.1 }}
623+
{"content_embedding":{"cats": 0.1 }}
624624
625625
- do:
626626
search:
@@ -631,13 +631,26 @@ teardown:
631631
field: content_embedding
632632
query_vector:
633633
pugs: 0.5
634-
cats: 0.5
635-
is: 0.04600334
634+
cats: 0.18
635+
is: 0.20
636636

637637
- match: { hits.total.value: 2 }
638638
- match: { hits.hits.0._id: "11" }
639639
- match: { hits.hits.1._id: "12" }
640640

641+
- do:
642+
search:
643+
index: test-sparse-vector-pruning-default
644+
body:
645+
query:
646+
sparse_vector:
647+
field: content_embedding
648+
query_vector:
649+
is: 0.21 # 0.2 is the weight threshold for the default pruning config
650+
651+
- match: { hits.total.value: 11 }
652+
653+
641654
- do:
642655
search:
643656
index: test-sparse-vector-pruning-default

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/sparse_vector_search.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ teardown:
944944
{"index": { "_id": "11" }}
945945
{"content_embedding":{"is": 0.6, "pugs": 0.6 }}
946946
{"index": { "_id": "12" }}
947-
{"content_embedding":{"is": 0.1891394, "pugs": 0.1 }}
947+
{"content_embedding":{"cats": 0.1 }}
948948
949949
- do:
950950
search:
@@ -955,13 +955,25 @@ teardown:
955955
field: content_embedding
956956
query_vector:
957957
pugs: 0.5
958-
cats: 0.5
959-
is: 0.04600334
958+
cats: 0.18
959+
is: 0.2
960960

961961
- match: { hits.total.value: 2 }
962962
- match: { hits.hits.0._id: "11" }
963963
- match: { hits.hits.1._id: "12" }
964964

965+
- do:
966+
search:
967+
index: test-sparse-vector-pruning-default
968+
body:
969+
query:
970+
sparse_vector:
971+
field: content_embedding
972+
query_vector:
973+
is: 0.21 # 0.2 is the weight threshold for the default pruning config
974+
975+
- match: { hits.total.value: 11 }
976+
965977
- do:
966978
search:
967979
index: test-sparse-vector-pruning-default

0 commit comments

Comments
 (0)