summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/search/aggregations/metrics
diff options
context:
space:
mode:
authorWinston Ewert <winstonewert@gmail.com>2017-05-02 13:24:23 +0300
committerColin Goodheart-Smithe <colings86@users.noreply.github.com>2017-05-02 11:24:23 +0100
commitc1ba4fdcb45fd7e2b50f0e5d236522b3e71cd7bc (patch)
tree47f0e672b3c3e7186fc71649fd08204a15e2052c /core/src/main/java/org/elasticsearch/search/aggregations/metrics
parentad3c042fc40880b47686a8d73b0d3401e66e1fcc (diff)
Allow scripted metric agg to access `_score` (#24295)
* Fixes #24259 Corrects the ScriptedMetricAggregator so that the script can have access to scores during the map stage. * Restored original tests. Added seperate test. As requested, I've restored the non-score dependant tests, and added the score dependent metric as a seperate test.
Diffstat (limited to 'core/src/main/java/org/elasticsearch/search/aggregations/metrics')
-rw-r--r--core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregator.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregator.java
index 3bfc057682..cee7b3402f 100644
--- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregator.java
+++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregator.java
@@ -63,7 +63,7 @@ public class ScriptedMetricAggregator extends MetricsAggregator {
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx,
final LeafBucketCollector sub) throws IOException {
final LeafSearchScript leafMapScript = mapScript.getLeafSearchScript(ctx);
- return new LeafBucketCollectorBase(sub, mapScript) {
+ return new LeafBucketCollectorBase(sub, leafMapScript) {
@Override
public void collect(int doc, long bucket) throws IOException {
assert bucket == 0 : bucket;