@@ -924,15 +924,21 @@ public void testDenseVectorDynamicMapping() throws Exception {
924924 client ().index (
925925 new IndexRequest ("test" ).source ("vector_bbq" , Randomness .get ().doubles (BBQ_DIMS_DEFAULT_THRESHOLD , 0.0 , 5.0 ).toArray ())
926926 ).get ();
927- Map <String , Object > mappings = indicesAdmin ().prepareGetMappings (TEST_REQUEST_TIMEOUT , "test" )
928- .get ()
929- .mappings ()
930- .get ("test" )
931- .sourceAsMap ();
932- assertTrue (new WriteField ("properties.vector_int8" , () -> mappings ).exists ());
933- assertTrue (new WriteField ("properties.vector_int8.index_options.type" , () -> mappings ).get (null ).toString ().equals ("int8_hnsw" ));
934- assertTrue (new WriteField ("properties.vector_bbq" , () -> mappings ).exists ());
935- assertTrue (new WriteField ("properties.vector_bbq.index_options.type" , () -> mappings ).get (null ).toString ().equals ("bbq_hnsw" ));
927+
928+ assertBusy (() -> {
929+ Map <String , Object > mappings = indicesAdmin ().prepareGetMappings (TEST_REQUEST_TIMEOUT , "test" )
930+ .get ()
931+ .mappings ()
932+ .get ("test" )
933+ .sourceAsMap ();
934+
935+ assertTrue (new WriteField ("properties.vector_int8" , () -> mappings ).exists ());
936+ assertTrue (
937+ new WriteField ("properties.vector_int8.index_options.type" , () -> mappings ).get (null ).toString ().equals ("int8_hnsw" )
938+ );
939+ assertTrue (new WriteField ("properties.vector_bbq" , () -> mappings ).exists ());
940+ assertTrue (new WriteField ("properties.vector_bbq.index_options.type" , () -> mappings ).get (null ).toString ().equals ("bbq_hnsw" ));
941+ });
936942 }
937943
938944 public void testBBQDynamicMappingWhenFirstIngestingDoc () throws Exception {
@@ -956,12 +962,15 @@ public void testBBQDynamicMappingWhenFirstIngestingDoc() throws Exception {
956962
957963 client ().index (new IndexRequest ("test" ).source ("vector" , Randomness .get ().doubles (BBQ_DIMS_DEFAULT_THRESHOLD , 0.0 , 5.0 ).toArray ()))
958964 .get ();
959- Map <String , Object > updatedMappings = indicesAdmin ().prepareGetMappings (TEST_REQUEST_TIMEOUT , "test" )
960- .get ()
961- .mappings ()
962- .get ("test" )
963- .sourceAsMap ();
964- assertTrue (new WriteField ("properties.vector" , () -> updatedMappings ).exists ());
965- assertTrue (new WriteField ("properties.vector.index_options.type" , () -> updatedMappings ).get (null ).toString ().equals ("bbq_hnsw" ));
965+
966+ assertBusy (() -> {
967+ Map <String , Object > updatedMappings = indicesAdmin ().prepareGetMappings (TEST_REQUEST_TIMEOUT , "test" )
968+ .get ()
969+ .mappings ()
970+ .get ("test" )
971+ .sourceAsMap ();
972+ assertTrue (new WriteField ("properties.vector" , () -> updatedMappings ).exists ());
973+ assertTrue (new WriteField ("properties.vector.index_options.type" , () -> updatedMappings ).get ("" ).toString ().equals ("bbq_hnsw" ));
974+ });
966975 }
967976}
0 commit comments