Skip to content

Commit 9db94aa

Browse files
committed
Add tests and service infrastructure
1 parent e8dd1e8 commit 9db94aa

File tree

10 files changed

+104
-33
lines changed

10 files changed

+104
-33
lines changed

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/type/DataType.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,9 @@ public enum DataType {
392392
// ES calls this 'point', but ESQL calls it 'cartesian_point'
393393
map.put("point", DataType.CARTESIAN_POINT);
394394
map.put("shape", DataType.CARTESIAN_SHAPE);
395+
// semantic_text is returned as text by field_caps, but unit tests will retrieve it from the mapping
396+
// so we need to map it here as well
397+
map.put("semantic_text", DataType.TEXT);
395398
ES_TO_TYPE = Collections.unmodifiableMap(map);
396399
// DATETIME has different esType and typeName, add an entry in NAME_TO_TYPE with date as key
397400
map = TYPES.stream().collect(toMap(DataType::typeName, t -> t));

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/EsqlSpecTestCase.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
import static org.elasticsearch.xpack.esql.CsvTestsDataLoader.loadDataSetIntoEs;
7474
import static org.elasticsearch.xpack.esql.EsqlTestUtils.classpathResources;
7575
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.COMPLETION;
76+
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.KNN_FUNCTION_V4;
7677
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.METRICS_COMMAND;
7778
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.RERANK;
7879
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.SEMANTIC_TEXT_FIELD_CAPS;
@@ -211,8 +212,12 @@ protected boolean supportsInferenceTestService() {
211212
}
212213

213214
protected boolean requiresInferenceEndpoint() {
214-
return Stream.of(SEMANTIC_TEXT_FIELD_CAPS.capabilityName(), RERANK.capabilityName(), COMPLETION.capabilityName())
215-
.anyMatch(testCase.requiredCapabilities::contains);
215+
return Stream.of(
216+
SEMANTIC_TEXT_FIELD_CAPS.capabilityName(),
217+
RERANK.capabilityName(),
218+
COMPLETION.capabilityName(),
219+
KNN_FUNCTION_V4.capabilityName()
220+
).anyMatch(testCase.requiredCapabilities::contains);
216221
}
217222

218223
protected boolean supportsIndexModeLookup() throws IOException {

x-pack/plugin/esql/qa/testFixtures/src/main/java/org/elasticsearch/xpack/esql/CsvTestsDataLoader.java

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,10 @@ public static void createInferenceEndpoints(RestClient client) throws IOExceptio
415415
createSparseEmbeddingInferenceEndpoint(client);
416416
}
417417

418+
if (clusterHasTextEmbeddingInferenceEndpoint(client) == false) {
419+
createTextEmbeddingInferenceEndpoint(client);
420+
}
421+
418422
if (clusterHasRerankInferenceEndpoint(client) == false) {
419423
createRerankInferenceEndpoint(client);
420424
}
@@ -426,11 +430,12 @@ public static void createInferenceEndpoints(RestClient client) throws IOExceptio
426430

427431
public static void deleteInferenceEndpoints(RestClient client) throws IOException {
428432
deleteSparseEmbeddingInferenceEndpoint(client);
433+
deleteTextEmbeddingInferenceEndpoint(client);
429434
deleteRerankInferenceEndpoint(client);
430435
deleteCompletionInferenceEndpoint(client);
431436
}
432437

433-
/** The semantic_text mapping type require an inference endpoint that needs to be setup before creating the index. */
438+
/** The semantic_text mapping type requires inference endpoints that need to be setup before creating the index. */
434439
public static void createSparseEmbeddingInferenceEndpoint(RestClient client) throws IOException {
435440
createInferenceEndpoint(client, TaskType.SPARSE_EMBEDDING, "test_sparse_inference", """
436441
{
@@ -441,14 +446,38 @@ public static void createSparseEmbeddingInferenceEndpoint(RestClient client) thr
441446
""");
442447
}
443448

449+
public static void createTextEmbeddingInferenceEndpoint(RestClient client) throws IOException {
450+
createInferenceEndpoint(client, TaskType.TEXT_EMBEDDING, "test_dense_inference", """
451+
{
452+
"service": "text_embedding_test_service",
453+
"service_settings": {
454+
"model": "my_model",
455+
"api_key": "abc64",
456+
"dimensions": 3,
457+
"similarity": "l2_norm",
458+
"element_type": "float"
459+
},
460+
"task_settings": { }
461+
}
462+
""");
463+
}
464+
444465
public static void deleteSparseEmbeddingInferenceEndpoint(RestClient client) throws IOException {
445466
deleteInferenceEndpoint(client, "test_sparse_inference");
446467
}
447468

469+
public static void deleteTextEmbeddingInferenceEndpoint(RestClient client) throws IOException {
470+
deleteInferenceEndpoint(client, "test_dense_inference");
471+
}
472+
448473
public static boolean clusterHasSparseEmbeddingInferenceEndpoint(RestClient client) throws IOException {
449474
return clusterHasInferenceEndpoint(client, TaskType.SPARSE_EMBEDDING, "test_sparse_inference");
450475
}
451476

477+
public static boolean clusterHasTextEmbeddingInferenceEndpoint(RestClient client) throws IOException {
478+
return clusterHasInferenceEndpoint(client, TaskType.TEXT_EMBEDDING, "test_dense_inference");
479+
}
480+
452481
public static void createRerankInferenceEndpoint(RestClient client) throws IOException {
453482
createInferenceEndpoint(client, TaskType.RERANK, "test_reranker", """
454483
{
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
_id:keyword,semantic_text_field:semantic_text,st_bool:semantic_text,st_cartesian_point:semantic_text,st_cartesian_shape:semantic_text,st_datetime:semantic_text,st_double:semantic_text,st_geopoint:semantic_text,st_geoshape:semantic_text,st_integer:semantic_text,st_ip:semantic_text,st_long:semantic_text,st_unsigned_long:semantic_text,st_version:semantic_text,st_multi_value:semantic_text,st_unicode:semantic_text,host:keyword,description:text,value:long,st_base64:semantic_text,st_logs:semantic_text,language_name:keyword
2-
1,live long and prosper,false,"POINT(4297.11 -1475.53)",,1953-09-02T00:00:00.000Z,5.20128E11,"POINT(42.97109630194 14.7552534413725)","POLYGON ((30 10\, 40 40\, 20 40\, 10 20\, 30 10))",23,1.1.1.1,2147483648,2147483648,1.2.3,["Hello there!", "This is a random value", "for testing purposes"],你吃饭了吗,"host1","some description1",1001,ZWxhc3RpYw==,"2024-12-23T12:15:00.000Z 1.2.3.4 [email protected] 4553",English
3-
2,all we have to decide is what to do with the time that is given to us,true,"POINT(7580.93 2272.77)",,2023-09-24T15:57:00.000Z,4541.11,"POINT(37.97109630194 21.7552534413725)","POLYGON ((30 10\, 40 40\, 20 40\, 10 20\, 30 10))",122,1.1.2.1,123,2147483648.2,9.0.0,["nice to meet you", "bye bye!"],["谢谢", "对不起我的中文不好"],"host2","some description2",1002,aGVsbG8=,"2024-01-23T12:15:00.000Z 1.2.3.4 [email protected] 42",French
4-
3,be excellent to each other,,,,,,,,,,,,,,,"host3","some description3",1003,,"2023-01-23T12:15:00.000Z 127.0.0.1 [email protected] 42",Spanish
1+
_id:keyword,semantic_text_field:semantic_text,semantic_text_dense_field:semantic_text,st_bool:semantic_text,st_cartesian_point:semantic_text,st_cartesian_shape:semantic_text,st_datetime:semantic_text,st_double:semantic_text,st_geopoint:semantic_text,st_geoshape:semantic_text,st_integer:semantic_text,st_ip:semantic_text,st_long:semantic_text,st_unsigned_long:semantic_text,st_version:semantic_text,st_multi_value:semantic_text,st_unicode:semantic_text,host:keyword,description:text,value:long,st_base64:semantic_text,st_logs:semantic_text,language_name:keyword
2+
1,live long and prosper,live long and prosper,false,"POINT(4297.11 -1475.53)",,1953-09-02T00:00:00.000Z,5.20128E11,"POINT(42.97109630194 14.7552534413725)","POLYGON ((30 10\, 40 40\, 20 40\, 10 20\, 30 10))",23,1.1.1.1,2147483648,2147483648,1.2.3,["Hello there!", "This is a random value", "for testing purposes"],你吃饭了吗,"host1","some description1",1001,ZWxhc3RpYw==,"2024-12-23T12:15:00.000Z 1.2.3.4 [email protected] 4553",English
3+
2,all we have to decide is what to do with the time that is given to us,all we have to decide is what to do with the time that is given to us,true,"POINT(7580.93 2272.77)",,2023-09-24T15:57:00.000Z,4541.11,"POINT(37.97109630194 21.7552534413725)","POLYGON ((30 10\, 40 40\, 20 40\, 10 20\, 30 10))",122,1.1.2.1,123,2147483648.2,9.0.0,["nice to meet you", "bye bye!"],["谢谢", "对不起我的中文不好"],"host2","some description2",1002,aGVsbG8=,"2024-01-23T12:15:00.000Z 1.2.3.4 [email protected] 42",French
4+
3,be excellent to each other,be excellent to each other,,,,,,,,,,,,,,,"host3","some description3",1003,,"2023-01-23T12:15:00.000Z 127.0.0.1 [email protected] 42",Spanish

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

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# top-n query at the shard level
44

55
knnSearch
6-
required_capability: knn_function_v3
6+
required_capability: knn_function_v4
77

88
// tag::knn-function[]
99
from colors metadata _score
@@ -30,7 +30,7 @@ chartreuse | [127.0, 255.0, 0.0]
3030
;
3131

3232
knnSearchWithSimilarityOption
33-
required_capability: knn_function_v3
33+
required_capability: knn_function_v4
3434

3535
from colors metadata _score
3636
| where knn(rgb_vector, [255,192,203], 140, {"similarity": 40})
@@ -46,7 +46,7 @@ wheat | [245.0, 222.0, 179.0]
4646
;
4747

4848
knnHybridSearch
49-
required_capability: knn_function_v3
49+
required_capability: knn_function_v4
5050

5151
from colors metadata _score
5252
| where match(color, "blue") or knn(rgb_vector, [65,105,225], 10)
@@ -68,7 +68,7 @@ yellow | [255.0, 255.0, 0.0]
6868
;
6969

7070
knnWithPrefilter
71-
required_capability: knn_function_v3
71+
required_capability: knn_function_v4
7272

7373
from colors
7474
| where knn(rgb_vector, [120,180,0], 10) and (match(color, "olive") or match(color, "green"))
@@ -82,7 +82,7 @@ olive
8282
;
8383

8484
knnWithNegatedPrefilter
85-
required_capability: knn_function_v3
85+
required_capability: knn_function_v4
8686

8787
from colors metadata _score
8888
| where knn(rgb_vector, [128,128,0], 10) and not (match(color, "olive") or match(color, "chocolate"))
@@ -105,7 +105,7 @@ orange | [255.0, 165.0, 0.0]
105105
;
106106

107107
knnAfterKeep
108-
required_capability: knn_function_v3
108+
required_capability: knn_function_v4
109109

110110
from colors metadata _score
111111
| keep rgb_vector, color, _score
@@ -124,7 +124,7 @@ rgb_vector:dense_vector
124124
;
125125

126126
knnAfterDrop
127-
required_capability: knn_function_v3
127+
required_capability: knn_function_v4
128128

129129
from colors metadata _score
130130
| drop primary
@@ -143,7 +143,7 @@ lime | [0.0, 255.0, 0.0]
143143
;
144144

145145
knnAfterEval
146-
required_capability: knn_function_v3
146+
required_capability: knn_function_v4
147147

148148
from colors metadata _score
149149
| eval composed_name = locate(color, " ") > 0
@@ -162,7 +162,7 @@ golden rod | true
162162
;
163163

164164
knnWithConjunction
165-
required_capability: knn_function_v3
165+
required_capability: knn_function_v4
166166

167167
from colors metadata _score
168168
| where knn(rgb_vector, [255,255,238], 10) and hex_code like "#FFF*"
@@ -181,7 +181,7 @@ yellow | #FFFF00 | [255.0, 255.0, 0.0]
181181
;
182182

183183
knnWithDisjunctionAndFiltersConjunction
184-
required_capability: knn_function_v3
184+
required_capability: knn_function_v4
185185

186186
from colors metadata _score
187187
| where (knn(rgb_vector, [0,255,255], 140) or knn(rgb_vector, [128, 0, 255], 10)) and primary == true
@@ -204,7 +204,7 @@ yellow | [255.0, 255.0, 0.0]
204204
;
205205

206206
knnWithNegationsAndFiltersConjunction
207-
required_capability: knn_function_v3
207+
required_capability: knn_function_v4
208208

209209
from colors metadata _score
210210
| where (knn(rgb_vector, [0,255,255], 140) and not(primary == true and match(color, "blue")))
@@ -227,7 +227,7 @@ azure | [240.0, 255.0, 255.0]
227227
;
228228

229229
knnWithNonPushableConjunction
230-
required_capability: knn_function_v3
230+
required_capability: knn_function_v4
231231

232232
from colors metadata _score
233233
| eval composed_name = locate(color, " ") > 0
@@ -251,7 +251,7 @@ maroon | false
251251
;
252252

253253
testKnnWithNonPushableDisjunctions
254-
required_capability: knn_function_v3
254+
required_capability: knn_function_v4
255255

256256
from colors metadata _score
257257
| where knn(rgb_vector, [128,128,0], 140, {"similarity": 30}) or length(color) > 10
@@ -267,7 +267,7 @@ papaya whip
267267
;
268268

269269
testKnnWithNonPushableDisjunctionsOnComplexExpressions
270-
required_capability: knn_function_v3
270+
required_capability: knn_function_v4
271271

272272
from colors metadata _score
273273
| where (knn(rgb_vector, [128,128,0], 140, {"similarity": 70}) and length(color) < 10) or (knn(rgb_vector, [128,0,128], 140, {"similarity": 60}) and primary == false)
@@ -282,7 +282,7 @@ indigo | false
282282
;
283283

284284
testKnnInStatsNonPushable
285-
required_capability: knn_function_v3
285+
required_capability: knn_function_v4
286286

287287
from colors
288288
| where length(color) < 10
@@ -294,7 +294,7 @@ c: long
294294
;
295295

296296
testKnnInStatsWithGrouping
297-
required_capability: knn_function_v3
297+
required_capability: knn_function_v4
298298
required_capability: full_text_functions_in_stats_where
299299

300300
from colors
@@ -306,3 +306,19 @@ c: long | primary: boolean
306306
41 | false
307307
9 | true
308308
;
309+
310+
testKnnWithWithSemanticText
311+
required_capability: knn_function_v4
312+
required_capability: semantic_text_field_caps
313+
314+
from semantic_text
315+
| where knn(semantic_text_dense_field, [0, 1, 2], 10)
316+
| keep semantic_text_dense_field
317+
| sort semantic_text_dense_field asc
318+
;
319+
320+
semantic_text_dense_field:text
321+
all we have to decide is what to do with the time that is given to us
322+
be excellent to each other
323+
live long and prosper
324+
;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
"vector": {
2222
"type": "dense_vector",
2323
"similarity": "l2_norm"
24+
},
25+
"semantic": {
26+
"type": "semantic_text",
27+
"inference_id": "test_inference"
2428
}
2529
}
2630
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
"type": "semantic_text",
55
"inference_id": "test_sparse_inference"
66
},
7+
"semantic_text_dense_field": {
8+
"type": "semantic_text",
9+
"inference_id": "test_dense_inference"
10+
},
711
"st_bool": {
812
"type": "semantic_text",
913
"inference_id": "test_sparse_inference"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public final void test() throws Throwable {
305305
);
306306
assumeFalse(
307307
"can't use KNN function in csv tests",
308-
testCase.requiredCapabilities.contains(EsqlCapabilities.Cap.KNN_FUNCTION_V3.capabilityName())
308+
testCase.requiredCapabilities.contains(EsqlCapabilities.Cap.KNN_FUNCTION_V4.capabilityName())
309309
);
310310
assumeFalse(
311311
"lookup join disabled for csv tests",

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/AnalyzerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2349,7 +2349,7 @@ public void testImplicitCasting() {
23492349

23502350
public void testDenseVectorImplicitCastingKnn() {
23512351
assumeTrue("dense_vector capability not available", EsqlCapabilities.Cap.DENSE_VECTOR_FIELD_TYPE.isEnabled());
2352-
assumeTrue("dense_vector capability not available", EsqlCapabilities.Cap.KNN_FUNCTION_V3.isEnabled());
2352+
assumeTrue("dense_vector capability not available", EsqlCapabilities.Cap.KNN_FUNCTION_V4.isEnabled());
23532353

23542354
checkDenseVectorCastingKnn("float_vector");
23552355
}

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ public void testFieldBasedFullTextFunctions() throws Exception {
12511251
checkFieldBasedWithNonIndexedColumn("Term", "term(text, \"cat\")", "function");
12521252
checkFieldBasedFunctionNotAllowedAfterCommands("Term", "function", "term(title, \"Meditation\")");
12531253
}
1254-
if (EsqlCapabilities.Cap.KNN_FUNCTION_V3.isEnabled()) {
1254+
if (EsqlCapabilities.Cap.KNN_FUNCTION_V4.isEnabled()) {
12551255
checkFieldBasedFunctionNotAllowedAfterCommands("KNN", "function", "knn(vector, [1, 2, 3], 10)");
12561256
}
12571257
}
@@ -1384,7 +1384,7 @@ public void testFullTextFunctionsOnlyAllowedInWhere() throws Exception {
13841384
if (EsqlCapabilities.Cap.MULTI_MATCH_FUNCTION.isEnabled()) {
13851385
checkFullTextFunctionsOnlyAllowedInWhere("MultiMatch", "multi_match(\"Meditation\", title, body)", "function");
13861386
}
1387-
if (EsqlCapabilities.Cap.KNN_FUNCTION_V3.isEnabled()) {
1387+
if (EsqlCapabilities.Cap.KNN_FUNCTION_V4.isEnabled()) {
13881388
checkFullTextFunctionsOnlyAllowedInWhere("KNN", "knn(vector, [0, 1, 2], 10)", "function");
13891389
}
13901390

@@ -1439,7 +1439,7 @@ public void testFullTextFunctionsDisjunctions() {
14391439
if (EsqlCapabilities.Cap.TERM_FUNCTION.isEnabled()) {
14401440
checkWithFullTextFunctionsDisjunctions("term(title, \"Meditation\")");
14411441
}
1442-
if (EsqlCapabilities.Cap.KNN_FUNCTION_V3.isEnabled()) {
1442+
if (EsqlCapabilities.Cap.KNN_FUNCTION_V4.isEnabled()) {
14431443
checkWithFullTextFunctionsDisjunctions("knn(vector, [1, 2, 3], 10)");
14441444
}
14451445
}
@@ -1504,7 +1504,7 @@ public void testFullTextFunctionsWithNonBooleanFunctions() {
15041504
if (EsqlCapabilities.Cap.TERM_FUNCTION.isEnabled()) {
15051505
checkFullTextFunctionsWithNonBooleanFunctions("Term", "term(title, \"Meditation\")", "function");
15061506
}
1507-
if (EsqlCapabilities.Cap.KNN_FUNCTION_V3.isEnabled()) {
1507+
if (EsqlCapabilities.Cap.KNN_FUNCTION_V4.isEnabled()) {
15081508
checkFullTextFunctionsWithNonBooleanFunctions("KNN", "knn(vector, [1, 2, 3], 10)", "function");
15091509
}
15101510
}
@@ -1575,7 +1575,7 @@ public void testFullTextFunctionsTargetsExistingField() throws Exception {
15751575
if (EsqlCapabilities.Cap.TERM_FUNCTION.isEnabled()) {
15761576
testFullTextFunctionTargetsExistingField("term(fist_name, \"Meditation\")");
15771577
}
1578-
if (EsqlCapabilities.Cap.KNN_FUNCTION_V3.isEnabled()) {
1578+
if (EsqlCapabilities.Cap.KNN_FUNCTION_V4.isEnabled()) {
15791579
testFullTextFunctionTargetsExistingField("knn(vector, [0, 1, 2], 10)");
15801580
}
15811581
}
@@ -2164,7 +2164,7 @@ public void testFullTextFunctionOptions() {
21642164
if (EsqlCapabilities.Cap.MULTI_MATCH_FUNCTION.isEnabled()) {
21652165
checkOptionDataTypes(MultiMatch.OPTIONS, "FROM test | WHERE MULTI_MATCH(\"Jean\", title, body, {\"%s\": %s})");
21662166
}
2167-
if (EsqlCapabilities.Cap.KNN_FUNCTION_V3.isEnabled()) {
2167+
if (EsqlCapabilities.Cap.KNN_FUNCTION_V4.isEnabled()) {
21682168
checkOptionDataTypes(Knn.ALLOWED_OPTIONS, "FROM test | WHERE KNN(vector, [0.1, 0.2, 0.3], 10, {\"%s\": %s})");
21692169
}
21702170
}
@@ -2257,7 +2257,7 @@ public void testFullTextFunctionsNullArgs() throws Exception {
22572257
checkFullTextFunctionNullArgs("term(null, \"query\")", "first");
22582258
checkFullTextFunctionNullArgs("term(title, null)", "second");
22592259
}
2260-
if (EsqlCapabilities.Cap.KNN_FUNCTION_V3.isEnabled()) {
2260+
if (EsqlCapabilities.Cap.KNN_FUNCTION_V4.isEnabled()) {
22612261
checkFullTextFunctionNullArgs("knn(null, [0, 1, 2], 10)", "first");
22622262
checkFullTextFunctionNullArgs("knn(vector, null, 10)", "second");
22632263
checkFullTextFunctionNullArgs("knn(vector, [0, 1, 2], null)", "third");
@@ -2289,7 +2289,7 @@ public void testFullTextFunctionsInStats() {
22892289
if (EsqlCapabilities.Cap.MULTI_MATCH_FUNCTION.isEnabled()) {
22902290
checkFullTextFunctionsInStats("multi_match(\"Meditation\", title, body)");
22912291
}
2292-
if (EsqlCapabilities.Cap.KNN_FUNCTION_V3.isEnabled()) {
2292+
if (EsqlCapabilities.Cap.KNN_FUNCTION_V4.isEnabled()) {
22932293
checkFullTextFunctionsInStats("knn(vector, [0, 1, 2], 10)");
22942294
}
22952295
}
@@ -2351,6 +2351,16 @@ public void testVectorSimilarityFunctionsNullArgs() throws Exception {
23512351
}
23522352
}
23532353

2354+
public void testFullTextFunctionsWithSemanticText() {
2355+
checkFullTextFunctionsWithSemanticText("knn(semantic, [0, 1, 2], 10)");
2356+
checkFullTextFunctionsWithSemanticText("match(semantic, \"hello world\")");
2357+
checkFullTextFunctionsWithSemanticText("semantic:\"hello world\"");
2358+
}
2359+
2360+
public void checkFullTextFunctionsWithSemanticText(String functionInvocation) {
2361+
query("from test | where " + functionInvocation, fullTextAnalyzer);
2362+
}
2363+
23542364
public void testToIPInvalidOptions() {
23552365
String query = "ROW result = to_ip(\"127.0.0.1\", 123)";
23562366
assertThat(error(query), containsString("second argument of [to_ip(\"127.0.0.1\", 123)] must be a map expression, received [123]"));

0 commit comments

Comments
 (0)