Skip to content

Commit

Permalink
Add integration test showing the problem
Browse files Browse the repository at this point in the history
  • Loading branch information
rdettai committed Dec 5, 2024
1 parent 5329379 commit e088fbf
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e088fbf

Please sign in to comment.