### CI Link

- https://gradle-enterprise.elastic.co/s/tl3jqzmzqyktq (PR branch)
- https://gradle-enterprise.elastic.co/s/6ao6q7f42tsly (main)

### Repro line

./gradlew ':server:test' --tests "org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapperTests.testVectorSimilarity" -Dtests.seed=39343A357A78EC3 -Dtests.locale=zh-CN -Dtests.timezone=Africa/Maseru -Druntime.java=21

### Does it reproduce?

Yes

### Applicable branches

main

### Failure history

_No response_

### Failure excerpt

  2> java.lang.AssertionError: expected:<COSINE> but was:<DOT_PRODUCT>
        at __randomizedtesting.SeedInfo.seed([39343A357A78EC3:75EC84B47EC59CF]:0)
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.failNotEquals(Assert.java:834)
        at org.junit.Assert.assertEquals(Assert.java:118)
        at org.junit.Assert.assertEquals(Assert.java:144)
        at org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapperTests.testVectorSimilarity(DenseVectorFieldMapperTests.java:776)
server/src/test/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapperTests.java
+ (setEfConstruction ? efConstruction : DEFAULT_BEAM_WIDTH)
            + ", flatVectorFormat=Lucene99FlatVectorsFormat()"
            + ")";
        assertEquals(expectedString, knnVectorsFormat.toString());
    }
    public void testKnnQuantizedHNSWVectorsFormat() throws IOException {
        final int m = randomIntBetween(1, DEFAULT_MAX_CONN + 10);
        final int efConstruction = randomIntBetween(1, DEFAULT_BEAM_WIDTH + 10);
        boolean setConfidenceInterval = randomBoolean();
        float confidenceInterval = (float) randomDoubleBetween(0.90f, 1.0f, true);
        MapperService mapperService = createMapperService(fieldMapping(b -> {
            b.field("type", "dense_vector");
            b.field("dims", 4);
            b.field("index", true);
            b.field("similarity", "dot_product");
            b.startObject("index_options");
            b.field("type", "int8_hnsw");
            b.field("m", m);
            b.field("ef_construction", efConstruction);
            if (setConfidenceInterval) {
                b.field("confidence_interval", confidenceInterval);
            }
            b.endObject();
        }));
        CodecService codecService = new CodecService(mapperService, BigArrays.NON_RECYCLING_INSTANCE);
        Codec codec = codecService.codec("default");
        assertThat(codec, instanceOf(PerFieldMapperCodec.class));
        KnnVectorsFormat knnVectorsFormat = ((PerFieldMapperCodec) codec).getKnnVectorsFormatForField("field");
        String expectedString = "Lucene99HnswScalarQuantizedVectorsFormat(name=Lucene99HnswScalarQuantizedVectorsFormat, maxConn="
            + m