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

Allow scripts to expose whether they use the _score. #12695

Merged
merged 1 commit into from Aug 6, 2015

Conversation

jpountz
Copy link
Contributor

@jpountz jpountz commented Aug 6, 2015

This commit adds a new API to allow scripts to say whether they need scores.
In practice, only the expression script engine makes use of it correctly,
other engines just return true since they can't predict whether they'll
need scores. This should make scripted aggregations and function_query
faster as we'll now be able to pass needsScores=false to Query.createWeight.

This commit adds a new API to allow scripts to say whether they need scores.
In practice, only the `expression` script engine makes use of it correctly,
other engines just return `true` since they can't predict whether they'll
need scores. This should make scripted aggregations and `function_query`
faster as we'll now be able to pass needsScores=false to Query.createWeight.
@jpountz jpountz added >enhancement review :Analytics/Aggregations Aggregations :Search/Search Search-related issues that do not fall into other categories :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v2.0.0 labels Aug 6, 2015
@jpountz
Copy link
Contributor Author

jpountz commented Aug 6, 2015

Native scripts can also make use of this optimization. But since we can't detect it like we do for expression scripts, they have to explicitely say whether they make use of scores or not.

@rmuir
Copy link
Contributor

rmuir commented Aug 6, 2015

Looks great. This is an important optimization to allow the whole rest of the query to be cached.

@jpountz jpountz removed :Analytics/Aggregations Aggregations :Search/Search Search-related issues that do not fall into other categories labels Aug 6, 2015
@rjernst
Copy link
Member

rjernst commented Aug 6, 2015

LGTM

jpountz added a commit that referenced this pull request Aug 6, 2015
Allow scripts to expose whether they use the `_score`.
@jpountz jpountz merged commit b59918f into elastic:master Aug 6, 2015
@jpountz jpountz deleted the enhancement/script_needs_scores branch August 6, 2015 16:47
imotov added a commit to imotov/elasticsearch-native-script-example that referenced this pull request Aug 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >enhancement v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants