Skip to content

Commit 0eeee59

Browse files
committed
remove sparse_vector exception change
1 parent 0d00ec5 commit 0eeee59

File tree

2 files changed

+0
-28
lines changed

2 files changed

+0
-28
lines changed

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/SemanticTextFieldMapper.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ public class SemanticTextFieldMapper extends FieldMapper implements InferenceFie
132132
private static final Logger logger = LogManager.getLogger(SemanticTextFieldMapper.class);
133133
public static final String WARNING_MESSAGE_8X = "Creating a `semantic_text` field on this index version may not include"
134134
+ " optimized default settings. Consider creating a new index for better performance.";
135-
public static final String ERROR_MESSAGE_UNSUPPORTED_SPARSE_VECTOR = "Creating a `semantic_text` field with `sparse_vector` models"
136-
+ " is not supported on this index. Try using a `dense_vector` model or create a new index with version 8.11+.";
137135
public static final NodeFeature SEMANTIC_TEXT_IN_OBJECT_FIELD_FIX = new NodeFeature("semantic_text.in_object_field_fix");
138136
public static final NodeFeature SEMANTIC_TEXT_SINGLE_FIELD_UPDATE_FIX = new NodeFeature("semantic_text.single_field_update_fix");
139137
public static final NodeFeature SEMANTIC_TEXT_DELETE_FIX = new NodeFeature("semantic_text.delete_fix");
@@ -1283,10 +1281,6 @@ private static void configureSparseVectorMapperBuilder(
12831281
SparseVectorFieldMapper.Builder sparseVectorMapperBuilder,
12841282
SemanticTextIndexOptions indexOptions
12851283
) {
1286-
if (indexVersionCreated.before(NEW_SPARSE_VECTOR)) {
1287-
throw new IllegalArgumentException(ERROR_MESSAGE_UNSUPPORTED_SPARSE_VECTOR);
1288-
}
1289-
12901284
if (indexOptions != null) {
12911285
SparseVectorFieldMapper.SparseVectorIndexOptions sparseVectorIndexOptions =
12921286
(SparseVectorFieldMapper.SparseVectorIndexOptions) indexOptions.indexOptions();

x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/mapper/SemanticTextFieldMapperTests.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -440,28 +440,6 @@ public void testOldIndexSemanticTextDenseVectorCreation() throws IOException {
440440
assertSemanticTextField(mapperService, fieldName, true, null, null);
441441
}
442442

443-
public void testOldIndexSemanticTextSparseVersionRaisesError() throws IOException {
444-
final XContentBuilder fieldMapping = fieldMapping(b -> {
445-
b.field("type", "semantic_text");
446-
b.field("inference_id", "another_inference_id");
447-
b.startObject("model_settings");
448-
b.field("task_type", "sparse_embedding");
449-
b.endObject();
450-
});
451-
452-
MapperParsingException exception = assertThrows(
453-
MapperParsingException.class,
454-
() -> createMapperService(
455-
fieldMapping,
456-
true,
457-
IndexVersions.V_8_0_0,
458-
IndexVersionUtils.getPreviousVersion(IndexVersions.NEW_SPARSE_VECTOR)
459-
)
460-
);
461-
assertTrue(exception.getMessage().contains(ERROR_MESSAGE_UNSUPPORTED_SPARSE_VECTOR));
462-
assertTrue(exception.getRootCause() instanceof IllegalArgumentException);
463-
}
464-
465443
public void testMultiFieldsSupport() throws IOException {
466444
if (useLegacyFormat) {
467445
Exception e = expectThrows(MapperParsingException.class, () -> createMapperService(fieldMapping(b -> {

0 commit comments

Comments
 (0)