Skip to content

Commit 03fc8b5

Browse files
authored
Remove SEMANTIC_TEXT data type in ES|QL (elastic#125581) (elastic#128811)
1 parent 040d629 commit 03fc8b5

File tree

64 files changed

+41
-226
lines changed

Some content is hidden

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

64 files changed

+41
-226
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
public class EsqlCorePlugin extends Plugin implements ExtensiblePlugin {
1515

16-
public static final FeatureFlag SEMANTIC_TEXT_FEATURE_FLAG = new FeatureFlag("esql_semantic_text");
1716
public static final FeatureFlag AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG = new FeatureFlag("esql_aggregate_metric_double");
1817
public static final FeatureFlag DENSE_VECTOR_FEATURE_FLAG = new FeatureFlag("esql_dense_vector");
1918
}

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,6 @@ public enum DataType {
301301
* mapping and should be hidden from users.
302302
*/
303303
PARTIAL_AGG(builder().esType("partial_agg").unknownSize()),
304-
/**
305-
* String fields that are split into chunks, where each chunk has attached embeddings
306-
* used for semantic search. Generally ESQL only sees {@code semantic_text} fields when
307-
* loaded from the index and ESQL will load these fields as strings without their attached
308-
* chunks or embeddings.
309-
*/
310-
SEMANTIC_TEXT(builder().esType("semantic_text").unknownSize()),
311304

312305
AGGREGATE_METRIC_DOUBLE(builder().esType("aggregate_metric_double").estimatedSize(Double.BYTES * 3 + Integer.BYTES)),
313306

@@ -323,7 +316,6 @@ public enum DataType {
323316
* check that sending them to a function produces a sane error message.
324317
*/
325318
public static final Map<DataType, FeatureFlag> UNDER_CONSTRUCTION = Map.ofEntries(
326-
Map.entry(SEMANTIC_TEXT, EsqlCorePlugin.SEMANTIC_TEXT_FEATURE_FLAG),
327319
Map.entry(AGGREGATE_METRIC_DOUBLE, EsqlCorePlugin.AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG),
328320
Map.entry(DENSE_VECTOR, EsqlCorePlugin.DENSE_VECTOR_FEATURE_FLAG)
329321
);
@@ -489,7 +481,7 @@ public static boolean isUnsupported(DataType from) {
489481
}
490482

491483
public static boolean isString(DataType t) {
492-
return t == KEYWORD || t == TEXT || t == SEMANTIC_TEXT;
484+
return t == KEYWORD || t == TEXT;
493485
}
494486

495487
public static boolean isPrimitiveAndSupported(DataType t) {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ public final void test() throws Throwable {
174174
}
175175

176176
protected void shouldSkipTest(String testName) throws IOException {
177-
if (testCase.requiredCapabilities.contains("semantic_text_type")
178-
|| testCase.requiredCapabilities.contains("semantic_text_field_caps")) {
177+
if (testCase.requiredCapabilities.contains("semantic_text_field_caps")) {
179178
assumeTrue("Inference test service needs to be supported for semantic_text", supportsInferenceTestService());
180179
}
181180
checkCapabilities(adminClient(), testFeatureService, testName, testCase);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
public abstract class SemanticMatchTestCase extends ESRestTestCase {
2525
public void testWithMultipleInferenceIds() throws IOException {
26-
assumeTrue("semantic text capability not available", EsqlCapabilities.Cap.SEMANTIC_TEXT_TYPE.isEnabled());
26+
assumeTrue("semantic text capability not available", EsqlCapabilities.Cap.SEMANTIC_TEXT_FIELD_CAPS.isEnabled());
2727

2828
String query = """
2929
from test-semantic1,test-semantic2
@@ -37,7 +37,7 @@ public void testWithMultipleInferenceIds() throws IOException {
3737
}
3838

3939
public void testWithInferenceNotConfigured() {
40-
assumeTrue("semantic text capability not available", EsqlCapabilities.Cap.SEMANTIC_TEXT_TYPE.isEnabled());
40+
assumeTrue("semantic text capability not available", EsqlCapabilities.Cap.SEMANTIC_TEXT_FIELD_CAPS.isEnabled());
4141

4242
String query = """
4343
from test-semantic3

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ public static Literal randomLiteral(DataType type) {
791791
case KEYWORD -> new BytesRef(randomAlphaOfLength(5));
792792
case IP -> new BytesRef(InetAddressPoint.encode(randomIp(randomBoolean())));
793793
case TIME_DURATION -> Duration.ofMillis(randomLongBetween(-604800000L, 604800000L)); // plus/minus 7 days
794-
case TEXT, SEMANTIC_TEXT -> new BytesRef(randomAlphaOfLength(50));
794+
case TEXT -> new BytesRef(randomAlphaOfLength(50));
795795
case VERSION -> randomVersion().toBytesRef();
796796
case GEO_POINT -> GEO.asWkb(GeometryTestUtils.randomPoint());
797797
case CARTESIAN_POINT -> CARTESIAN.asWkb(ShapeTestUtils.randomPoint());

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,6 @@ emp_no_bool:boolean
601601

602602
testMatchWithSemanticText
603603
required_capability: match_function
604-
required_capability: semantic_text_type
605604
required_capability: semantic_text_field_caps
606605

607606
from semantic_text
@@ -618,7 +617,6 @@ live long and prosper
618617

619618
testMatchWithSemanticTextAndKeyword
620619
required_capability: match_function
621-
required_capability: semantic_text_type
622620
required_capability: semantic_text_field_caps
623621

624622
from semantic_text
@@ -632,7 +630,6 @@ live long and prosper | host1
632630

633631
testMatchWithSemanticTextMultiValueField
634632
required_capability: match_function
635-
required_capability: semantic_text_type
636633
required_capability: semantic_text_field_caps
637634

638635
from semantic_text metadata _id
@@ -646,7 +643,6 @@ _id: keyword | st_multi_value:text
646643

647644
testMatchWithSemanticTextWithEvalsAndOtherFunctionsAndStats
648645
required_capability: match_function
649-
required_capability: semantic_text_type
650646
required_capability: semantic_text_field_caps
651647

652648
from semantic_text
@@ -662,7 +658,6 @@ result:long
662658

663659
testMatchWithSemanticTextAndKql
664660
required_capability: match_function
665-
required_capability: semantic_text_type
666661
required_capability: kql_function
667662
required_capability: semantic_text_field_caps
668663

x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-operator.csv-spec

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,6 @@ emp_no_bool:boolean
611611

612612
testMatchWithSemanticText
613613
required_capability: match_operator_colon
614-
required_capability: semantic_text_type
615614
required_capability: semantic_text_field_caps
616615

617616
from semantic_text
@@ -628,7 +627,6 @@ live long and prosper
628627

629628
testMatchWithSemanticTextAndKeyword
630629
required_capability: match_operator_colon
631-
required_capability: semantic_text_type
632630
required_capability: semantic_text_field_caps
633631

634632
from semantic_text
@@ -642,7 +640,6 @@ live long and prosper | host1
642640

643641
testMatchWithSemanticTextMultiValueField
644642
required_capability: match_operator_colon
645-
required_capability: semantic_text_type
646643
required_capability: semantic_text_field_caps
647644

648645
from semantic_text metadata _id
@@ -656,7 +653,6 @@ _id: keyword | st_multi_value:text
656653

657654
testMatchWithSemanticTextWithEvalsAndOtherFunctionsAndStats
658655
required_capability: match_operator_colon
659-
required_capability: semantic_text_type
660656
required_capability: semantic_text_field_caps
661657

662658
from semantic_text
@@ -672,7 +668,6 @@ result:long
672668

673669
testMatchWithSemanticTextAndKql
674670
required_capability: match_operator_colon
675-
required_capability: semantic_text_type
676671
required_capability: kql_function
677672
required_capability: semantic_text_field_caps
678673

@@ -743,7 +738,6 @@ _id:keyword | language_name:keyword | language_code:integer
743738

744739
testMatchWithSemanticTextKqlAndLookupJoin
745740
required_capability: match_operator_colon
746-
required_capability: semantic_text_type
747741
required_capability: kql_function
748742
required_capability: semantic_text_field_caps
749743
required_capability: join_lookup_v12

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ book_no:keyword | title:text
325325

326326
semanticTextMatch
327327
required_capability: metadata_score
328-
required_capability: semantic_text_type
328+
required_capability: semantic_text_field_caps
329329
required_capability: match_function
330330

331331
from semantic_text metadata _id, _score
@@ -343,7 +343,7 @@ _id:keyword
343343
semanticTextMatchWithAllTheTextFunctions
344344

345345
required_capability: metadata_score
346-
required_capability: semantic_text_type
346+
required_capability: semantic_text_field_caps
347347
required_capability: match_function
348348
required_capability: kql_function
349349
required_capability: qstr_function

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ _id:keyword | my_field:text
8989
;
9090

9191
simpleStats
92-
required_capability: semantic_text_type
92+
required_capability: semantic_text_field_caps
9393

9494
FROM semantic_text METADATA _id
9595
| STATS COUNT(*)
@@ -100,7 +100,7 @@ COUNT(*):long
100100
;
101101

102102
statsWithGrouping
103-
required_capability: semantic_text_type
103+
required_capability: semantic_text_field_caps
104104

105105
FROM semantic_text METADATA _id
106106
| STATS COUNT(*) BY st_version

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,10 +584,6 @@ public enum Cap {
584584
* Adding stats for functions (stack telemetry)
585585
*/
586586
FUNCTION_STATS,
587-
/**
588-
* Support for semantic_text field mapping
589-
*/
590-
SEMANTIC_TEXT_TYPE(EsqlCorePlugin.SEMANTIC_TEXT_FEATURE_FLAG),
591587
/**
592588
* Fix for an optimization that caused wrong results
593589
* https://github.com/elastic/elasticsearch/issues/115281

0 commit comments

Comments
 (0)