Skip to content

Commit 325a305

Browse files
ioanatiaelasticmachinecraigtaverner
authored
[8.x] Backport semantic text string support (#116235)
* semantic_text as string type in ES|QL - support for functions and operators (#115243) * fix tests * Add CSV tests * Add function tests * Refactor tests * spotless * Use DataType.stringTypes() where possible * Add tests for conditional functions and expressions * Fix tests after merge * Reorder semantic_text evaluators and tests * Re-ordered two more places for SEMANTIC_TEXT after TEXT --------- Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Craig Taverner <[email protected]> * Fix release tests for semantic_text (#116202) --------- Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Craig Taverner <[email protected]>
1 parent 7770441 commit 325a305

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1221
-100
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ public static boolean isUnsupported(DataType from) {
370370
}
371371

372372
public static boolean isString(DataType t) {
373-
return t == KEYWORD || t == TEXT;
373+
return t == KEYWORD || t == TEXT || t == SEMANTIC_TEXT;
374374
}
375375

376376
public static boolean isPrimitiveAndSupported(DataType t) {
@@ -585,7 +585,7 @@ static Builder builder() {
585585
}
586586

587587
public DataType noText() {
588-
return this == TEXT ? KEYWORD : this;
588+
return isString(this) ? KEYWORD : this;
589589
}
590590

591591
/**

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
@@ -68,6 +68,10 @@
6868
},
6969
"value": {
7070
"type": "long"
71+
},
72+
"st_base64": {
73+
"type": "semantic_text",
74+
"inference_id": "test_sparse_inference"
7175
}
7276
}
7377
}
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
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
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
4-
3,be excellent to each other,,,,,,,,,,,,,,,"host3","some description3",1003
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
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==
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=
4+
3,be excellent to each other,,,,,,,,,,,,,,,"host3","some description3",1003,

0 commit comments

Comments
 (0)