diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/CustomScoreQueryParser.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/CustomScoreQueryParser.java index dd860438f22..cd70ed0f982 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/CustomScoreQueryParser.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/CustomScoreQueryParser.java @@ -120,6 +120,7 @@ public class CustomScoreQueryParser extends AbstractIndexComponent implements XC @Override public float score(int docId, float subQueryScore) { vars.put("score", subQueryScore); + vars.put("_score", subQueryScore); return ((Number) scriptFieldsFunction.execute(docId, vars)).floatValue(); }