@@ -794,9 +794,9 @@ private static void assertSemanticTextField(
794794 IndexVersion indexVersion = mapperService .getIndexSettings ().getIndexVersionCreated ();
795795
796796 SparseVectorFieldMapper .SparseVectorIndexOptions applied = sparseVectorFieldMapper .fieldType ().getIndexOptions ();
797- SparseVectorFieldMapper .SparseVectorIndexOptions expected = ( expectedIndexOptions != null )
798- ? ( SparseVectorFieldMapper .SparseVectorIndexOptions ) expectedIndexOptions . indexOptions ( )
799- : SparseVectorFieldMapper .SparseVectorIndexOptions . getDefaultIndexOptions ( indexVersion );
797+ SparseVectorFieldMapper .SparseVectorIndexOptions expected = expectedIndexOptions == null
798+ ? SparseVectorFieldMapper .SparseVectorIndexOptions . getDefaultIndexOptions ( indexVersion )
799+ : ( SparseVectorFieldMapper .SparseVectorIndexOptions ) expectedIndexOptions . indexOptions ( );
800800 assertEquals (expected , applied );
801801 }
802802 case TEXT_EMBEDDING -> {
@@ -1403,17 +1403,6 @@ public void testDefaultIndexOptions() throws IOException {
14031403 );
14041404 assertSemanticTextField (mapperService , "field" , true , null , defaultDenseVectorSemanticIndexOptions ());
14051405
1406- IndexVersion sparseVectorIndexVersion = randomBoolean ()
1407- ? IndexVersionUtils .randomVersionBetween (
1408- random (),
1409- IndexVersions .UPGRADE_TO_LUCENE_10_0_0 ,
1410- IndexVersionUtils .getPreviousVersion (IndexVersions .SPARSE_VECTOR_PRUNING_INDEX_OPTIONS_SUPPORT )
1411- )
1412- : IndexVersionUtils .randomVersionBetween (
1413- random (),
1414- IndexVersions .SPARSE_VECTOR_PRUNING_INDEX_OPTIONS_SUPPORT ,
1415- IndexVersion .current ()
1416- );
14171406 mapperService = createMapperService (fieldMapping (b -> {
14181407 b .field ("type" , "semantic_text" );
14191408 b .field ("inference_id" , "another_inference_id" );
@@ -1425,7 +1414,14 @@ public void testDefaultIndexOptions() throws IOException {
14251414 IndexVersionUtils .getPreviousVersion (IndexVersions .SPARSE_VECTOR_PRUNING_INDEX_OPTIONS_SUPPORT ),
14261415 IndexVersions .SPARSE_VECTOR_PRUNING_INDEX_OPTIONS_SUPPORT
14271416 );
1428- assertSemanticTextField (mapperService , "field" , true , null , defaultSparseVectorIndexOptions (sparseVectorIndexVersion ));
1417+
1418+ assertSemanticTextField (
1419+ mapperService ,
1420+ "field" ,
1421+ true ,
1422+ null ,
1423+ defaultSparseVectorIndexOptions (mapperService .getIndexSettings ().getIndexVersionCreated ())
1424+ );
14291425 }
14301426
14311427 public void testSpecifiedDenseVectorIndexOptions () throws IOException {
0 commit comments