mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 01:22:26 -04:00
Fixing race condition in DynamicMappingIT when checking for updates in mappings (#129931)
This commit is contained in:
parent
7249ac4d42
commit
07f65e978a
2 changed files with 31 additions and 21 deletions
|
@ -565,9 +565,6 @@ tests:
|
||||||
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapperTests
|
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapperTests
|
||||||
method: testExistsQueryMinimalMapping
|
method: testExistsQueryMinimalMapping
|
||||||
issue: https://github.com/elastic/elasticsearch/issues/129911
|
issue: https://github.com/elastic/elasticsearch/issues/129911
|
||||||
- class: org.elasticsearch.index.mapper.DynamicMappingIT
|
|
||||||
method: testDenseVectorDynamicMapping
|
|
||||||
issue: https://github.com/elastic/elasticsearch/issues/129928
|
|
||||||
|
|
||||||
# Examples:
|
# Examples:
|
||||||
#
|
#
|
||||||
|
|
|
@ -920,19 +920,27 @@ public class DynamicMappingIT extends ESIntegTestCase {
|
||||||
|
|
||||||
client().index(
|
client().index(
|
||||||
new IndexRequest("test").source("vector_int8", Randomness.get().doubles(BBQ_DIMS_DEFAULT_THRESHOLD - 1, 0.0, 5.0).toArray())
|
new IndexRequest("test").source("vector_int8", Randomness.get().doubles(BBQ_DIMS_DEFAULT_THRESHOLD - 1, 0.0, 5.0).toArray())
|
||||||
|
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
|
||||||
).get();
|
).get();
|
||||||
client().index(
|
client().index(
|
||||||
new IndexRequest("test").source("vector_bbq", Randomness.get().doubles(BBQ_DIMS_DEFAULT_THRESHOLD, 0.0, 5.0).toArray())
|
new IndexRequest("test").source("vector_bbq", Randomness.get().doubles(BBQ_DIMS_DEFAULT_THRESHOLD, 0.0, 5.0).toArray())
|
||||||
|
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
|
||||||
).get();
|
).get();
|
||||||
Map<String, Object> mappings = indicesAdmin().prepareGetMappings(TEST_REQUEST_TIMEOUT, "test")
|
|
||||||
.get()
|
assertBusy(() -> {
|
||||||
.mappings()
|
Map<String, Object> mappings = indicesAdmin().prepareGetMappings(TEST_REQUEST_TIMEOUT, "test")
|
||||||
.get("test")
|
.get()
|
||||||
.sourceAsMap();
|
.mappings()
|
||||||
assertTrue(new WriteField("properties.vector_int8", () -> mappings).exists());
|
.get("test")
|
||||||
assertTrue(new WriteField("properties.vector_int8.index_options.type", () -> mappings).get(null).toString().equals("int8_hnsw"));
|
.sourceAsMap();
|
||||||
assertTrue(new WriteField("properties.vector_bbq", () -> mappings).exists());
|
|
||||||
assertTrue(new WriteField("properties.vector_bbq.index_options.type", () -> mappings).get(null).toString().equals("bbq_hnsw"));
|
assertTrue(new WriteField("properties.vector_int8", () -> mappings).exists());
|
||||||
|
assertTrue(
|
||||||
|
new WriteField("properties.vector_int8.index_options.type", () -> mappings).get(null).toString().equals("int8_hnsw")
|
||||||
|
);
|
||||||
|
assertTrue(new WriteField("properties.vector_bbq", () -> mappings).exists());
|
||||||
|
assertTrue(new WriteField("properties.vector_bbq.index_options.type", () -> mappings).get(null).toString().equals("bbq_hnsw"));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBBQDynamicMappingWhenFirstIngestingDoc() throws Exception {
|
public void testBBQDynamicMappingWhenFirstIngestingDoc() throws Exception {
|
||||||
|
@ -954,14 +962,19 @@ public class DynamicMappingIT extends ESIntegTestCase {
|
||||||
assertTrue(new WriteField("properties.vector", () -> mappings).exists());
|
assertTrue(new WriteField("properties.vector", () -> mappings).exists());
|
||||||
assertFalse(new WriteField("properties.vector.index_options.type", () -> mappings).exists());
|
assertFalse(new WriteField("properties.vector.index_options.type", () -> mappings).exists());
|
||||||
|
|
||||||
client().index(new IndexRequest("test").source("vector", Randomness.get().doubles(BBQ_DIMS_DEFAULT_THRESHOLD, 0.0, 5.0).toArray()))
|
client().index(
|
||||||
.get();
|
new IndexRequest("test").source("vector", Randomness.get().doubles(BBQ_DIMS_DEFAULT_THRESHOLD, 0.0, 5.0).toArray())
|
||||||
Map<String, Object> updatedMappings = indicesAdmin().prepareGetMappings(TEST_REQUEST_TIMEOUT, "test")
|
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
|
||||||
.get()
|
).get();
|
||||||
.mappings()
|
|
||||||
.get("test")
|
assertBusy(() -> {
|
||||||
.sourceAsMap();
|
Map<String, Object> updatedMappings = indicesAdmin().prepareGetMappings(TEST_REQUEST_TIMEOUT, "test")
|
||||||
assertTrue(new WriteField("properties.vector", () -> updatedMappings).exists());
|
.get()
|
||||||
assertTrue(new WriteField("properties.vector.index_options.type", () -> updatedMappings).get(null).toString().equals("bbq_hnsw"));
|
.mappings()
|
||||||
|
.get("test")
|
||||||
|
.sourceAsMap();
|
||||||
|
assertTrue(new WriteField("properties.vector", () -> updatedMappings).exists());
|
||||||
|
assertTrue(new WriteField("properties.vector.index_options.type", () -> updatedMappings).get("").toString().equals("bbq_hnsw"));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue