-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scripting: Ambiguous resolution of _doc.score
#7043
Comments
+1 on using |
For reference, here is a confirmation that in case of a conflict Groovy prefers the map access: http://groovy.329449.n5.nabble.com/Property-resolution-clash-for-Map-subclasses-td5717713.html |
@jpountz I looked and we already support |
+1 |
Closes #7043 Conflicts: docs/reference/modules/scripting.asciidoc
As pointed out in elastic#7487 DocLookup is a variable that is accessible by all scripts for one doc while the query is executed. But the _score and therfore the scorer depends on the current context, that is, which part of query is currently executed. Instead of setting the scorer for DocLookup and have Script access the DocLookup for getting the score, the Scorer should just be explicitely set for each script. DocLookup should not have any reference to a scorer. This was similarly discussed in elastic#7043. This dependency caused a stackoverflow when running script score in combination with an aggregation on _score. Also the wrong scorer was called when nesting several script scores. closes elastic#7487
As pointed out in #7487 DocLookup is a variable that is accessible by all scripts for one doc while the query is executed. But the _score and therfore the scorer depends on the current context, that is, which part of query is currently executed. Instead of setting the scorer for DocLookup and have Script access the DocLookup for getting the score, the Scorer should just be explicitely set for each script. DocLookup should not have any reference to a scorer. This was similarly discussed in #7043. This dependency caused a stackoverflow when running script score in combination with an aggregation on _score. Also the wrong scorer was called when nesting several script scores. closes #7487 closes #7819
As pointed out in #7487 DocLookup is a variable that is accessible by all scripts for one doc while the query is executed. But the _score and therfore the scorer depends on the current context, that is, which part of query is currently executed. Instead of setting the scorer for DocLookup and have Script access the DocLookup for getting the score, the Scorer should just be explicitely set for each script. DocLookup should not have any reference to a scorer. This was similarly discussed in #7043. This dependency caused a stackoverflow when running script score in combination with an aggregation on _score. Also the wrong scorer was called when nesting several script scores. closes #7487 closes #7819
As pointed out in #7487 DocLookup is a variable that is accessible by all scripts for one doc while the query is executed. But the _score and therfore the scorer depends on the current context, that is, which part of query is currently executed. Instead of setting the scorer for DocLookup and have Script access the DocLookup for getting the score, the Scorer should just be explicitely set for each script. DocLookup should not have any reference to a scorer. This was similarly discussed in #7043. This dependency caused a stackoverflow when running script score in combination with an aggregation on _score. Also the wrong scorer was called when nesting several script scores. closes #7487 closes #7819
_doc.score
_doc.score
- Changed "doc.score" and "_doc.score" to "_score", per elastic/elasticsearch#7043 - Upgraded gems while I was at it (latest sidekiq-unique-jobs requires explicit inclusion of mock_redis gem) Closes #6
As pointed out in elastic#7487 DocLookup is a variable that is accessible by all scripts for one doc while the query is executed. But the _score and therfore the scorer depends on the current context, that is, which part of query is currently executed. Instead of setting the scorer for DocLookup and have Script access the DocLookup for getting the score, the Scorer should just be explicitely set for each script. DocLookup should not have any reference to a scorer. This was similarly discussed in elastic#7043. This dependency caused a stackoverflow when running script score in combination with an aggregation on _score. Also the wrong scorer was called when nesting several script scores. closes elastic#7487 closes elastic#7819
Hello to everyone, I just upgraded elasticsearch from 1.3.4 to 1.4.4 and I am getting the aforementioned error: I have read the initial workaround but I did not understand unfortunately how to proceed. |
Some scripting languages don't make a difference between property access
foo.bar
and map lookupsfoo['bar']
. This is an issue for theDocLookup
class (which is the class behind the_doc
variable and implementsjava.util.Map
) since there are two ways that_doc.score
can be resolved:DocLookup.getScore()
DocLookup.get("score")
.The interesting thing is that mvel translates
_doc.score
togetScore
while Groovy seems to translate it toget("score")
. So when trying to lookup the score in Groovy, you might see the following error:For reference, if you encounter this issue, you can work around it by using
_score
instead of_doc.score
. So maybe the way to go would be to deprecate_doc.score
and make scripting engines expose the score via_score
instead. I tend to find it cleaner as well since the score is not really a property of the document (it also depends on the query).The text was updated successfully, but these errors were encountered: