diff --git a/src/main/java/org/opensearch/flowframework/workflow/RankSearchResultStep.java b/src/main/java/org/opensearch/flowframework/workflow/RankSearchResultStep.java index 25c946e32..c8325b752 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/RankSearchResultStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/RankSearchResultStep.java @@ -40,8 +40,8 @@ public SearchHits rankAsec(SearchHits hits) { List sortedHits = originalHits.stream() .sorted((hit1, hit2) -> { // Extract the "aa" field values as Double from the source maps of hit1 and hit2 - Double aa1 = toDouble(hit1.getSourceAsMap().get("aa")); - Double aa2 = toDouble(hit2.getSourceAsMap().get("aa")); + Double aa1 = toDouble(hit1.getSourceAsMap().get("sepal_length_in_cm")); + Double aa2 = toDouble(hit2.getSourceAsMap().get("sepal_length_in_cm")); // Use Double.compare to compare the "aa" field values, handling nulls return Double.compare(aa1 != null ? aa1 : Double.MIN_VALUE, aa2 != null ? aa2 : Double.MIN_VALUE);