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

Add more script contexts #30721

Merged
merged 2 commits into from
May 20, 2018
Merged

Conversation

martijnvg
Copy link
Member

Added dedicated script contexts for:

  • script function score
  • script sorting
  • terms_set query

Scripts for these contexts will either have a specific return value or
use scoring and therefor in the future will need their own scripting classes.

Spin off from #30511

@martijnvg martijnvg added >non-issue review :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v7.0.0 v6.4.0 labels May 18, 2018
@martijnvg martijnvg requested a review from rjernst May 18, 2018 12:37
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Note that long term we still need to make these real script contexts (not using SearchScript, but their own) so that their api matches the comments you left with each context object. But this change is fine to enable

public static final ScriptContext<Factory> SCRIPT_SORT_CONTEXT = new ScriptContext<>("script_sort", Factory.class);
// Can return a float
public static final ScriptContext<Factory> SCRIPT_SCORE_CONTEXT = new ScriptContext<>("script_score", Factory.class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call this just score? I've been trying to give the script context identifiers names that don't include "script" since that is implicit.

// Can return a double. (For ScriptSortType#NUMBER only, for ScriptSortType#STRING normal CONTEXT should be used)
public static final ScriptContext<Factory> SCRIPT_SORT_CONTEXT = new ScriptContext<>("script_sort", Factory.class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too, can use just "sort" for the context name?

public static final ScriptContext<Factory> SCRIPT_SCORE_CONTEXT = new ScriptContext<>("script_score", Factory.class);
// Can return a long
public static final ScriptContext<Factory> TERMS_SET_QUERY_CONTEXT = new ScriptContext<>("terms_set_query", Factory.class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this can just be "terms_set" too

Added dedicated script contexts for:
* script function score
* script sorting
* terms_set query

Scripts for these contexts will either have a specific return value or
use scoring and therefor in the future will need their own scripting classes.

Relates to elastic#30511
@martijnvg
Copy link
Member Author

Thanks for reviewing and follow ups are needed to make specialised contexts.

@martijnvg martijnvg merged commit 314cd6f into elastic:master May 20, 2018
martijnvg added a commit that referenced this pull request May 20, 2018
Added dedicated script contexts for:
* script function score
* script sorting
* terms_set query

Scripts for these contexts will either have a specific return value or
use scoring and therefor in the future will need their own scripting classes.

Relates to #30511
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request May 21, 2018
…ne-liners

* elastic/master:
  [TEST] Enable DEBUG logging on testAutoQueueSizingWithMax
  [ML] Don't install empty ML metadata on startup (elastic#30751)
  Add assertion on removing copy_settings (elastic#30748)
  bump lucene version for 6_3_0
  [DOCS] Mark painless execute api as experimental (elastic#30710)
  disable annotation processor for docs (elastic#30610)
  Add more script contexts (elastic#30721)
  Fix default shards count in create index docs (elastic#30747)
dnhatn added a commit that referenced this pull request May 21, 2018
* master:
  Reduce CLI scripts to one-liners (#30759)
  SQL: Preserve scoring in bool queries (#30730)
  QA: Switch rolling upgrade to 3 nodes (#30728)
  [TEST] Enable DEBUG logging on testAutoQueueSizingWithMax
  [ML] Don't install empty ML metadata on startup (#30751)
  Add assertion on removing copy_settings (#30748)
  bump lucene version for 6_3_0
  [DOCS] Mark painless execute api as experimental (#30710)
  disable annotation processor for docs (#30610)
  Add more script contexts (#30721)
  Fix default shards count in create index docs (#30747)
  Mute testCorruptFileThenSnapshotAndRestore
dnhatn added a commit that referenced this pull request May 21, 2018
* 6.x:
  SQL: Preserve scoring in bool queries (#30730)
  QA: Switch rolling upgrade to 3 nodes
  [ML] Don't install empty ML metadata on startup (#30751)
  bump lucene version for 6_3_0
  [DOCS] Mark painless execute api as experimental (#30710)
  Add more script contexts (#30721)
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request May 22, 2018
* es/ccr: (50 commits)
  Reduce CLI scripts to one-liners (elastic#30759)
  SQL: Preserve scoring in bool queries (elastic#30730)
  QA: Switch rolling upgrade to 3 nodes (elastic#30728)
  [TEST] Enable DEBUG logging on testAutoQueueSizingWithMax
  [ML] Don't install empty ML metadata on startup (elastic#30751)
  Add assertion on removing copy_settings (elastic#30748)
  bump lucene version for 6_3_0
  [DOCS] Mark painless execute api as experimental (elastic#30710)
  disable annotation processor for docs (elastic#30610)
  Add more script contexts (elastic#30721)
  Fix default shards count in create index docs (elastic#30747)
  Mute testCorruptFileThenSnapshotAndRestore
  Scripting: Remove getDate methods from ScriptDocValues (elastic#30690)
  Upgrade to Lucene-7.4.0-snapshot-59f2b7aec2 (elastic#30726)
  [Docs] Fix single page :docs:check invocation (elastic#30725)
  Docs: Add uptasticsearch to list of clients (elastic#30738)
  [DOCS] Removes out-dated x-pack/docs/en/index.asciidoc
  [DOCS] Removes redundant index.asciidoc files (elastic#30707)
  [TEST] Reduce forecast overflow to disk test memory limit (elastic#30727)
  Plugins: Remove meta plugins (elastic#30670)
  ...
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 >non-issue v6.4.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants