@@ -306,3 +306,74 @@ c: long | primary: boolean
30630641 | false
3073079 | true
308308;
309+
310+ testKnnWithSemanticText
311+ required_capability: knn_function_v4
312+
313+ from semantic_text
314+ | where knn(semantic_text_dense_field, [0, 1, 2], 10)
315+ | keep semantic_text_dense_field
316+ | sort semantic_text_dense_field asc
317+ ;
318+
319+ semantic_text_dense_field:text
320+ all we have to decide is what to do with the time that is given to us
321+ be excellent to each other
322+ live long and prosper
323+ ;
324+
325+ testKnnWithSemanticTextAndKeyword
326+ required_capability: knn_function_v4
327+
328+ from semantic_text
329+ | where knn(semantic_text_dense_field, [0, 1, 2], 10)
330+ | keep semantic_text_dense_field, host
331+ | sort host asc
332+ ;
333+
334+ semantic_text_dense_field:text | host:keyword
335+ live long and prosper | host1
336+ all we have to decide is what to do with the time that is given to us | host2
337+ be excellent to each other | host3
338+
339+ ;
340+
341+ testKnnWithSemanticTextMultiValueField
342+ required_capability: knn_function_v4
343+
344+ from semantic_text metadata _id
345+ | where match(st_multi_value, "something") AND match(host, "host1")
346+ | keep _id, st_multi_value
347+ ;
348+
349+ _id: keyword | st_multi_value:text
350+ 1 | ["Hello there!", "This is a random value", "for testing purposes"]
351+ ;
352+
353+ testKnnWithSemanticTextWithEvalsAndOtherFunctionsAndStats
354+ required_capability: knn_function_v4
355+
356+ from semantic_text
357+ | where qstr("description:some*")
358+ | eval size = mv_count(st_multi_value)
359+ | where knn(semantic_text_dense_field, [0, 1, 2], 10)
360+ | STATS result = count(*)
361+ ;
362+
363+ result:long
364+ 3
365+ ;
366+
367+ testKnnWithSemanticTextAndKql
368+ required_capability: knn_function_v4
369+ required_capability: kql_function
370+
371+ from semantic_text
372+ | where kql("host:host1") AND knn(semantic_text_dense_field, [0, 1, 2], 10)
373+ | KEEP host, semantic_text_dense_field
374+ ;
375+
376+ host:keyword | semantic_text_dense_field:text
377+ "host1" | live long and prosper
378+ ;
379+
0 commit comments