Skip to content
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

Missing doc.score documentation #7712

Closed
Vineeth-Mohan opened this issue Sep 12, 2014 · 3 comments
Closed

Missing doc.score documentation #7712

Vineeth-Mohan opened this issue Sep 12, 2014 · 3 comments

Comments

@Vineeth-Mohan
Copy link

I found the variable doc.score very useful but then it don't have documentation in http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html , but it has documentation in http://www.elasticsearch.cn/guide/reference/modules/scripting.html .

Kindly add this information.

@colings86
Copy link
Contributor

The score for the current document can be accessed by a script using the _score variable which is equivalent to doc.score. This is the preferred way of accessing the score and is documented at http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_score

@Vineeth-Mohan
Copy link
Author

Hello @colings86

ES script - 1.3.2

I am not able to access this field in aggs scripts -
{
"aggs": {
"sum": {
"sum": {
"script": "doc.score"
}
}
}
}

Works

{
"aggs": {
"sum": {
"sum": {
"script": "_score"
}
}
}
}

gives - QueryPhaseExecutionException[[twitter][2]: query[ConstantScore(:)],from[0],size[10]: Query Failed [Failed to execute main query]]; nested: PropertyAccessException[[Error: unresolvable property or identifier: _score] [Near : {... _score ....}] ^ [Line: 1, Column: 1]];

@clintongormley
Copy link

@Vineeth-Mohan it works in groovy, not mvel (which is deprecated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants