From 2bd9a63467e3e9b57d8960df5516fcae64f78951 Mon Sep 17 00:00:00 2001 From: kimchy Date: Thu, 12 Aug 2010 18:41:29 +0300 Subject: [PATCH] Query DSL: custom score script, allow to use `_score` as well as `score` as the underlying query score, closes #316. --- .../index/query/xcontent/CustomScoreQueryParser.java | 1 + 1 file changed, 1 insertion(+) 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(); }