From e088fbf0aef4cf03083dbd2de3ede8c8698fdfe9 Mon Sep 17 00:00:00 2001 From: Remi Dettai Date: Thu, 5 Dec 2024 15:39:53 +0100 Subject: [PATCH] Add integration test showing the problem --- .../tests/update_tests/doc_mapping_tests.rs | 32 +++++++++++++++++++ .../src/tests/update_tests/mod.rs | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/quickwit/quickwit-integration-tests/src/tests/update_tests/doc_mapping_tests.rs b/quickwit/quickwit-integration-tests/src/tests/update_tests/doc_mapping_tests.rs index c1d55860b20..6dae8582fff 100644 --- a/quickwit/quickwit-integration-tests/src/tests/update_tests/doc_mapping_tests.rs +++ b/quickwit/quickwit-integration-tests/src/tests/update_tests/doc_mapping_tests.rs @@ -545,6 +545,38 @@ async fn test_update_doc_mapping_dynamic_to_strict() { .await; } +#[tokio::test] +async fn test_update_doc_mapping_dynamic_to_strict_with_nested() { + let index_id = "update_dynamic_to_strict_with_nested"; + let original_doc_mappings = json!({ + "mode": "dynamic", + "field_mappings": [], + }); + let ingest_before_update = &[json!({"body": {"inner_body": "hello"}})]; + let updated_doc_mappings = json!({ + "mode": "dynamic", + "field_mappings": [ + { + "name": "body", + "type": "text", + } + ], + }); + let ingest_after_update = &[json!({"body": "world"})]; + validate_search_across_doc_mapping_updates( + index_id, + original_doc_mappings, + ingest_before_update, + updated_doc_mappings, + ingest_after_update, + &[( + "body.inner_body:hello", + Ok(&[json!({"body": {"inner_body": "hello"}})]), + )], + ) + .await; +} + #[tokio::test] async fn test_update_doc_mapping_add_field_on_strict() { let index_id = "update-add-field-on-strict"; diff --git a/quickwit/quickwit-integration-tests/src/tests/update_tests/mod.rs b/quickwit/quickwit-integration-tests/src/tests/update_tests/mod.rs index ad6bb67bcc5..835102c89eb 100644 --- a/quickwit/quickwit-integration-tests/src/tests/update_tests/mod.rs +++ b/quickwit/quickwit-integration-tests/src/tests/update_tests/mod.rs @@ -41,7 +41,7 @@ async fn assert_hits_unordered( ) .await; if let Ok(expected_hits) = expected_result { - let resp = search_res.unwrap_or_else(|_| panic!("query: {}", query)); + let resp = search_res.unwrap_or_else(|err| panic!("query: {}, error: {}", query, err)); assert_eq!(resp.errors.len(), 0, "query: {}", query); assert_eq!( resp.num_hits,