Skip to content

Commit 4b02126

Browse files
authored
Merge branch 'main' into esql-rerank-tech-preview
2 parents fc12bf1 + fe4a523 commit 4b02126

File tree

2 files changed

+36
-142
lines changed

2 files changed

+36
-142
lines changed

muted-tests.yml

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -512,123 +512,15 @@ tests:
512512
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
513513
method: test {p0=transform/transforms_crud/Test transform where source query is invalid}
514514
issue: https://github.com/elastic/elasticsearch/issues/132111
515-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
516-
method: testDenseVectorMappingUpdate {initialType=bbq_flat updateType=bbq_hnsw}
517-
issue: https://github.com/elastic/elasticsearch/issues/132112
518-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
519-
method: testDenseVectorMappingUpdate {initialType=hnsw updateType=int4_hnsw}
520-
issue: https://github.com/elastic/elasticsearch/issues/132113
521-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
522-
method: testDenseVectorMappingUpdate {initialType=hnsw updateType=bbq_hnsw}
523-
issue: https://github.com/elastic/elasticsearch/issues/132115
524-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
525-
method: testDenseVectorMappingUpdate {initialType=int8_flat updateType=int8_hnsw}
526-
issue: https://github.com/elastic/elasticsearch/issues/132116
527-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
528-
method: testDenseVectorMappingUpdate {initialType=int4_flat updateType=int8_hnsw}
529-
issue: https://github.com/elastic/elasticsearch/issues/132117
530-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
531-
method: testDenseVectorMappingUpdate {initialType=flat updateType=hnsw}
532-
issue: https://github.com/elastic/elasticsearch/issues/132119
533-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
534-
method: testDenseVectorMappingUpdate {initialType=flat updateType=bbq_flat}
535-
issue: https://github.com/elastic/elasticsearch/issues/132120
536-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
537-
method: testDenseVectorMappingUpdate {initialType=int8_flat updateType=bbq_disk}
538-
issue: https://github.com/elastic/elasticsearch/issues/132122
539-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
540-
method: testDenseVectorMappingUpdate {initialType=int8_flat updateType=int4_hnsw}
541-
issue: https://github.com/elastic/elasticsearch/issues/132123
542-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
543-
method: testDenseVectorMappingUpdate {initialType=int8_flat updateType=hnsw}
544-
issue: https://github.com/elastic/elasticsearch/issues/132124
545-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
546-
method: testDenseVectorMappingUpdate {initialType=int8_flat updateType=int4_flat}
547-
issue: https://github.com/elastic/elasticsearch/issues/132125
548-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
549-
method: testDenseVectorMappingUpdate {initialType=flat updateType=int8_hnsw}
550-
issue: https://github.com/elastic/elasticsearch/issues/132126
551-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
552-
method: testDenseVectorMappingUpdate {initialType=bbq_disk updateType=bbq_disk}
553-
issue: https://github.com/elastic/elasticsearch/issues/132127
554-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
555-
method: testDenseVectorMappingUpdate {initialType=flat updateType=int8_flat}
556-
issue: https://github.com/elastic/elasticsearch/issues/132129
557-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
558-
method: "testDenseVectorMappingUpdate {initialType=flat updateType=bbq_disk #2}"
559-
issue: https://github.com/elastic/elasticsearch/issues/132130
560-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
561-
method: testDenseVectorMappingUpdate {initialType=int4_flat updateType=bbq_flat}
562-
issue: https://github.com/elastic/elasticsearch/issues/132132
563-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
564-
method: testDenseVectorMappingUpdate {initialType=int8_hnsw updateType=int4_hnsw}
565-
issue: https://github.com/elastic/elasticsearch/issues/132133
566-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
567-
method: testDenseVectorMappingUpdate {initialType=bbq_flat updateType=bbq_disk}
568-
issue: https://github.com/elastic/elasticsearch/issues/132134
569-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
570-
method: testDenseVectorMappingUpdate {initialType=int4_flat updateType=int4_hnsw}
571-
issue: https://github.com/elastic/elasticsearch/issues/132140
572-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
573-
method: testDenseVectorMappingUpdate {initialType=int8_flat updateType=bbq_hnsw}
574-
issue: https://github.com/elastic/elasticsearch/issues/132141
575515
- class: org.elasticsearch.index.engine.MergeWithLowDiskSpaceIT
576516
method: testRelocationWhileForceMerging
577517
issue: https://github.com/elastic/elasticsearch/issues/131789
578-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
579-
method: testDenseVectorMappingUpdate {initialType=flat updateType=int4_hnsw}
580-
issue: https://github.com/elastic/elasticsearch/issues/132149
581-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
582-
method: testDenseVectorMappingUpdate {initialType=int4_flat updateType=hnsw}
583-
issue: https://github.com/elastic/elasticsearch/issues/132150
584-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
585-
method: testDenseVectorMappingUpdate {initialType=int8_flat updateType=bbq_flat}
586-
issue: https://github.com/elastic/elasticsearch/issues/132151
587-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
588-
method: "testDenseVectorMappingUpdate {initialType=bbq_hnsw updateType=bbq_disk #2}"
589-
issue: https://github.com/elastic/elasticsearch/issues/132152
590-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
591-
method: testDenseVectorMappingUpdate {initialType=hnsw updateType=int8_hnsw}
592-
issue: https://github.com/elastic/elasticsearch/issues/132164
593-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
594-
method: testDenseVectorMappingUpdate {initialType=int4_hnsw updateType=bbq_disk}
595-
issue: https://github.com/elastic/elasticsearch/issues/132165
596518
- class: org.elasticsearch.indices.cluster.FieldCapsForceConnectTimeoutIT
597519
method: testTimeoutSetting
598520
issue: https://github.com/elastic/elasticsearch/issues/132179
599-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
600-
method: "testDenseVectorMappingUpdate {initialType=bbq_flat updateType=bbq_disk #2}"
601-
issue: https://github.com/elastic/elasticsearch/issues/132184
602-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
603-
method: testDenseVectorMappingUpdate {initialType=bbq_hnsw updateType=bbq_disk}
604-
issue: https://github.com/elastic/elasticsearch/issues/132188
605-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
606-
method: "testDenseVectorMappingUpdate {initialType=int8_flat updateType=bbq_disk #2}"
607-
issue: https://github.com/elastic/elasticsearch/issues/132189
608-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
609-
method: testDenseVectorMappingUpdate {initialType=int4_hnsw updateType=bbq_hnsw}
610-
issue: https://github.com/elastic/elasticsearch/issues/132211
611-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
612-
method: "testDenseVectorMappingUpdate {initialType=int8_hnsw updateType=bbq_disk #2}"
613-
issue: https://github.com/elastic/elasticsearch/issues/132213
614-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
615-
method: testDenseVectorMappingUpdate {initialType=int8_hnsw updateType=bbq_disk}
616-
issue: https://github.com/elastic/elasticsearch/issues/132214
617521
- class: org.elasticsearch.xpack.security.authz.store.CompositeRolesStoreTests
618522
method: testCacheCleanupOnProjectDeletion
619523
issue: https://github.com/elastic/elasticsearch/issues/132218
620-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
621-
method: testDenseVectorMappingUpdate {initialType=int4_flat updateType=bbq_hnsw}
622-
issue: https://github.com/elastic/elasticsearch/issues/132219
623-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
624-
method: testDenseVectorMappingUpdate {initialType=hnsw updateType=bbq_disk}
625-
issue: https://github.com/elastic/elasticsearch/issues/132220
626-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
627-
method: testDenseVectorMappingUpdate {initialType=int4_flat updateType=bbq_disk}
628-
issue: https://github.com/elastic/elasticsearch/issues/132221
629-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
630-
method: testDenseVectorMappingUpdate {initialType=flat updateType=bbq_disk}
631-
issue: https://github.com/elastic/elasticsearch/issues/132222
632524
- class: org.elasticsearch.test.rest.yaml.MDPYamlTestSuiteIT
633525
method: test {yaml=mdp/10_basic/Index using shared data path}
634526
issue: https://github.com/elastic/elasticsearch/issues/132223
@@ -638,13 +530,6 @@ tests:
638530
- class: org.elasticsearch.xpack.logsdb.qa.StoredSourceLogsDbVersusReindexedLogsDbChallengeRestIT
639531
method: testTermsQuery
640532
issue: https://github.com/elastic/elasticsearch/issues/132226
641-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
642-
method: "testDenseVectorMappingUpdate {initialType=int4_hnsw updateType=bbq_disk #2}"
643-
issue: https://github.com/elastic/elasticsearch/issues/132228
644-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
645-
method: "testDenseVectorMappingUpdate {initialType=int4_flat updateType=bbq_disk #2}"
646-
issue: https://github.com/elastic/elasticsearch/issues/132234
647-
648533
# Examples:
649534
#
650535
# Mute a single test case in a YAML test suite:

server/src/internalClusterTest/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldIndexTypeUpdateIT.java

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
import com.carrotsearch.randomizedtesting.annotations.Name;
1313
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
1414

15+
import org.elasticsearch.action.DocWriteResponse;
1516
import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse;
1617
import org.elasticsearch.action.index.IndexRequest;
1718
import org.elasticsearch.cluster.metadata.IndexMetadata;
1819
import org.elasticsearch.common.settings.Settings;
20+
import org.elasticsearch.rest.RestStatus;
21+
import org.elasticsearch.search.vectors.KnnVectorQueryBuilder;
1922
import org.elasticsearch.test.ESIntegTestCase;
2023
import org.elasticsearch.xcontent.XContentBuilder;
2124
import org.elasticsearch.xcontent.XContentFactory;
@@ -25,6 +28,7 @@
2528
import java.util.Collection;
2629
import java.util.List;
2730
import java.util.Map;
31+
import java.util.concurrent.ExecutionException;
2832

2933
import static org.elasticsearch.index.IndexSettings.INDEX_MAPPER_SOURCE_MODE_SETTING;
3034
import static org.elasticsearch.index.mapper.SourceFieldMapper.Mode.SYNTHETIC;
@@ -75,7 +79,7 @@ public static Collection<Object[]> params() {
7579
@SuppressWarnings("unchecked")
7680
public void testDenseVectorMappingUpdate() throws Exception {
7781
dimensions = randomIntBetween(1, 10) * 64;
78-
var client = client().admin().indices();
82+
var indicesClient = client().admin().indices();
7983

8084
Settings.Builder settingsBuilder = Settings.builder()
8185
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
@@ -85,7 +89,7 @@ public void testDenseVectorMappingUpdate() throws Exception {
8589
}
8690

8791
// Create index with initial mapping
88-
var createRequest = client.prepareCreate(INDEX_NAME)
92+
var createRequest = indicesClient.prepareCreate(INDEX_NAME)
8993
.setSettings(Settings.builder().put("index.number_of_shards", randomIntBetween(1, 5)))
9094
.setMapping(updateMapping(dimensions, initialType))
9195
.setSettings(settingsBuilder.build());
@@ -97,16 +101,16 @@ public void testDenseVectorMappingUpdate() throws Exception {
97101
indexDoc(i);
98102
}
99103

100-
client.prepareFlush(INDEX_NAME).get();
101-
client.prepareRefresh(INDEX_NAME).get();
104+
indicesClient.prepareFlush(INDEX_NAME).get();
105+
indicesClient.prepareRefresh(INDEX_NAME).get();
102106

103107
// Update mapping to new type
104-
var putMappingRequest = client.preparePutMapping(INDEX_NAME).setSource(updateMapping(dimensions, updateType)).request();
105-
assertAcked(client.putMapping(putMappingRequest));
108+
var putMappingRequest = indicesClient.preparePutMapping(INDEX_NAME).setSource(updateMapping(dimensions, updateType)).request();
109+
assertAcked(indicesClient.putMapping(putMappingRequest));
106110

107111
// Validate mapping
108-
GetFieldMappingsResponse fieldMapping = client.getFieldMappings(
109-
client.prepareGetFieldMappings(INDEX_NAME).setFields(VECTOR_FIELD).request()
112+
GetFieldMappingsResponse fieldMapping = indicesClient.getFieldMappings(
113+
indicesClient.prepareGetFieldMappings(INDEX_NAME).setFields(VECTOR_FIELD).request()
110114
).get();
111115
var fieldMappingMetadata = fieldMapping.fieldMappings(INDEX_NAME, VECTOR_FIELD);
112116
var fieldMap = (Map<String, Object>) fieldMappingMetadata.sourceAsMap().get(VECTOR_FIELD);
@@ -119,28 +123,32 @@ public void testDenseVectorMappingUpdate() throws Exception {
119123
indexDoc(i);
120124
}
121125

122-
client.prepareFlush(INDEX_NAME).get();
123-
client.prepareRefresh(INDEX_NAME).get();
126+
indicesClient.prepareFlush(INDEX_NAME).get();
127+
indicesClient.prepareRefresh(INDEX_NAME).get();
124128

125129
// Search to ensure all documents are present
126130
int expectedDocs = docsBefore + docsAfter;
127-
assertNoFailuresAndResponse(client().prepareSearch(INDEX_NAME).setSize(expectedDocs + 10), response -> {
128-
assertHitCount(response, expectedDocs);
129-
});
130-
}
131131

132-
private XContentBuilder initialMapping(int dimensions, String type) throws IOException {
133-
XContentBuilder builder = XContentFactory.jsonBuilder();
134-
builder.startObject();
135-
{
136-
builder.startObject("mappings");
137-
{
138-
createFieldMapping(dimensions, type, builder);
132+
// Count query
133+
assertNoFailuresAndResponse(
134+
client().prepareSearch(INDEX_NAME).setSize(0).setTrackTotalHits(true).setSize(expectedDocs),
135+
response -> {
136+
assertHitCount(response, expectedDocs);
139137
}
140-
builder.endObject();
138+
);
139+
140+
// KNN query
141+
float[] queryVector = new float[dimensions];
142+
for (int i = 0; i < queryVector.length; i++) {
143+
queryVector[i] = randomFloatBetween(-1, 1, true);
141144
}
142-
builder.endObject();
143-
return builder;
145+
KnnVectorQueryBuilder queryBuilder = new KnnVectorQueryBuilder(VECTOR_FIELD, queryVector, null, null, null, null);
146+
assertNoFailuresAndResponse(
147+
client().prepareSearch(INDEX_NAME).setQuery(queryBuilder).setTrackTotalHits(true).setSize(expectedDocs),
148+
response -> {
149+
assertHitCount(response, expectedDocs);
150+
}
151+
);
144152
}
145153

146154
private XContentBuilder updateMapping(int dimensions, String type) throws IOException {
@@ -168,9 +176,10 @@ private static void createFieldMapping(int dimensions, String type, XContentBuil
168176
builder.endObject();
169177
}
170178

171-
private void indexDoc(int id) throws IOException {
179+
private void indexDoc(int id) throws ExecutionException, InterruptedException {
172180
Float[] vector = randomArray(dimensions, dimensions, Float[]::new, () -> randomFloatBetween(-1, 1, true));
173-
IndexRequest req = prepareIndex(INDEX_NAME).setSource(VECTOR_FIELD, vector).setId(Integer.toString(id)).request();
174-
client().index(req);
181+
IndexRequest indexRequest = prepareIndex(INDEX_NAME).setSource(VECTOR_FIELD, vector).setId(Integer.toString(id)).request();
182+
DocWriteResponse indexResponse = client().index(indexRequest).get();
183+
assertEquals(RestStatus.CREATED, indexResponse.status());
175184
}
176185
}

0 commit comments

Comments
 (0)