From 7c3df12d31c198619b6565e35a1d20d71eafb9ab Mon Sep 17 00:00:00 2001 From: Neetika Singhal Date: Wed, 27 Dec 2023 12:14:12 -0800 Subject: [PATCH] Fix SimpleNestedIT.testExplain flaky test Signed-off-by: Neetika Singhal --- .../java/org/opensearch/search/nested/SimpleNestedIT.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/src/internalClusterTest/java/org/opensearch/search/nested/SimpleNestedIT.java b/server/src/internalClusterTest/java/org/opensearch/search/nested/SimpleNestedIT.java index 6d0b074c3a660..8e30b1c5d7674 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/nested/SimpleNestedIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/nested/SimpleNestedIT.java @@ -487,6 +487,13 @@ public void testExplain() throws Exception { ) .setRefreshPolicy(IMMEDIATE) .get(); + + // refresh is important to enforce creation of a segment for document ingest above + // and prevent merging with deleted segemnts created by the index random function + // this ensures that the range doesnt change for the child docs asserted below + // ref: https://github.com/opensearch-project/OpenSearch/issues/11413 + refresh("test"); + indexRandomForConcurrentSearch("test"); SearchResponse searchResponse = client().prepareSearch("test")