diff --git a/qa/restart-upgrade/src/test/java/org/opensearch/neuralsearch/bwc/HybridSearchIT.java b/qa/restart-upgrade/src/test/java/org/opensearch/neuralsearch/bwc/HybridSearchIT.java index dd2c806aa..36dfef02f 100644 --- a/qa/restart-upgrade/src/test/java/org/opensearch/neuralsearch/bwc/HybridSearchIT.java +++ b/qa/restart-upgrade/src/test/java/org/opensearch/neuralsearch/bwc/HybridSearchIT.java @@ -12,6 +12,9 @@ import java.util.Map; import org.opensearch.index.query.MatchQueryBuilder; + +import static org.opensearch.knn.index.query.KNNQueryBuilder.EXPAND_NESTED_FIELD; +import static org.opensearch.neuralsearch.common.MinClusterVersionUtil.isClusterOnOrAfterMinReqVersion; import static org.opensearch.neuralsearch.util.TestUtils.getModelId; import static org.opensearch.neuralsearch.util.TestUtils.NODES_BWC_CLUSTER; import static org.opensearch.neuralsearch.util.TestUtils.PARAM_NAME_WEIGHTS; @@ -73,7 +76,7 @@ private void validateNormalizationProcessor(final String fileName, final String addDocuments(getIndexNameForTest(), false); HybridQueryBuilder hybridQueryBuilder = getQueryBuilder(modelId, null, null, null); validateTestIndex(getIndexNameForTest(), searchPipelineName, hybridQueryBuilder); - hybridQueryBuilder = getQueryBuilder(modelId, Boolean.TRUE, Map.of("ef_search", 100), RescoreContext.getDefault()); + hybridQueryBuilder = getQueryBuilder(modelId, Boolean.FALSE, Map.of("ef_search", 100), RescoreContext.getDefault()); validateTestIndex(getIndexNameForTest(), searchPipelineName, hybridQueryBuilder); } finally { wipeOfTestResources(getIndexNameForTest(), pipelineName, modelId, searchPipelineName); @@ -126,7 +129,7 @@ private HybridQueryBuilder getQueryBuilder( neuralQueryBuilder.modelId(modelId); neuralQueryBuilder.queryText(QUERY); neuralQueryBuilder.k(5); - if (expandNestedDocs != null) { + if (isClusterOnOrAfterMinReqVersion(EXPAND_NESTED_FIELD.getPreferredName()) && expandNestedDocs != null) { neuralQueryBuilder.expandNested(expandNestedDocs); } if (methodParameters != null) {