-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Update by Query is modified to accept short script
parameter.
#26841
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some minor requests for changes but it looks good to me! Thanks for doing this and I'm sorry for leading you astray with my mistaken comments earlier.
assert config != null : "Script should not be null"; | ||
|
||
if (config instanceof String) { | ||
return new Script((String) config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix the indentation on this to line up?
return new Script(type, lang, script, params); | ||
return new Script(type, lang, script, params); | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually don't put a newline between }
and else
. Can you undo?
@elasticmachine, test this please. |
Can you add a test for this? I'd add it to |
@nik9000, thanks for comments. |
I created a test and tried to launch it, but I it's not executing. So, I've created a topic on elastic forum with description of the error |
@nik9000, Thanks for help with testing. I pushed formatting changes and a new test |
Thanks @pozhidaevak! I've merged to master and will cherry-pick into 6.x and push that after the tests pass for me locally. I didn't think to ask you before, but would you like to write the documentation update for this? This page is generated by |
Update by Query is modified to accept short `script` parameter. Closes issue #24898
@nik9000, yah, I’ll add a documentation. Do I need to mention full version from which short form of script is accepted by API? If so, what is the version? |
@pozhidaevak you don't need to mention the version in the docs because I'll only backport your documentation change only to the branches that have the change. When the targeted version is released we'll flip "current" version of the docs to the version with your change. Folks that browse older versions of the docs won't get docs for your change. The targeted version for this is 6.1/7.0. The master branch that you developed it against is 7.0 and the 6.x branch that I backported it to is planned to be 6.1. |
* master: (35 commits) Create weights lazily in filter and filters aggregation (#26983) Use a dedicated ThreadGroup in rest sniffer (#26897) Fire global checkpoint sync under system context Update by Query is modified to accept short `script` parameter. (#26841) Cat shards bytes (#26952) Add support for parsing inline script (#23824) (#26846) Change default value to true for transpositions parameter of fuzzy query (#26901) Adding unreleased 5.6.4 version number to Version.java Rename TCPTransportTests to TcpTransportTests (#26954) Fix NPE for /_cat/indices when no primary shard (#26953) [DOCS] Fixed indentation of the definition list. Fix formatting in channel close test Check for closed connection while opening Clarify systemd overrides [DOCS] Plugin Installation for Windows (#21671) Painless: add tests for cached boxing (#24163) Don't detect source's XContentType in DocumentParser.parseDocument() (#26880) Fix handling of paths containing parentheses Allow only a fixed-size receive predictor (#26165) Add Homebrew instructions to getting started ...
* 6.x: (32 commits) Use a dedicated ThreadGroup in rest sniffer (#26897) Fire global checkpoint sync under system context Update by Query is modified to accept short `script` parameter. (#26841) Cat shards bytes (#26952) Adding unreleased 5.6.4 version number to Version.java Rename TCPTransportTests to TcpTransportTests (#26954) Fix NPE for /_cat/indices when no primary shard (#26953) [DOCS] Fixed indentation of the definition list. Check for closed connection while opening Clarify systemd overrides [DOCS] Plugin Installation for Windows (#21671) Painless: add tests for cached boxing (#24163) Don't detect source's XContentType in DocumentParser.parseDocument() (#26880) Return List instead of an array from settings (#26903) Emit deprecation warning for variable size predictor Fix handling of paths containing parentheses Deprecate variable-size receive predictor Add Homebrew instructions to getting started ingest: Fix bug that prevent date_index_name processor from accepting timestamps specified as a json number Scripting: Fix expressions to temporarily support filter scripts (#26824) ...
@nik9000, thanks for explaining. I think I've found an inconsistency between code and documentation in the code we have public static final String DEFAULT_SCRIPT_LANG = "painless";
//some code is omitted
// this constructor is used to create simple script
public Script(String idOrCode) {
this(DEFAULT_SCRIPT_TYPE, DEFAULT_SCRIPT_LANG, idOrCode, Collections.emptyMap(), Collections.emptyMap());
} But in the documentation it is stated (from using.asciidoc):
However, it needs to be checked by running some tests... |
|
* master: (356 commits) Do not set SO_LINGER on server channels (elastic#26997) Fix inconsistencies in the rest api specs for *_script (elastic#26971) fix inconsistencies in the rest api specs for cat.snapshots (elastic#26996) Add docs on full_id parameter in cat nodes API [TEST] Add test that replicates versioned updates with random flushes Use internal searcher for all indexing related operations in the engine Reformat paragraph in template docs to 80 columns Clarify settings and template on create index Fix reference to TcpTransport in documentation Allow Uid#decodeId to decode from a byte array slice (elastic#26987) Fix a typo in the similarity docs (elastic#26970) Use separate searchers for "search visibility" vs "move indexing buffer to disk (elastic#26972) Create weights lazily in filter and filters aggregation (elastic#26983) Use a dedicated ThreadGroup in rest sniffer (elastic#26897) Fire global checkpoint sync under system context Update by Query is modified to accept short `script` parameter. (elastic#26841) Cat shards bytes (elastic#26952) Add support for parsing inline script (elastic#23824) (elastic#26846) Change default value to true for transpositions parameter of fuzzy query (elastic#26901) Adding unreleased 5.6.4 version number to Version.java ...
This change adding support of both long and short form of
script
parameter to_update_by_query
request.It should close the issue #24898 .
Changes in code:
static function
RestUpdateByQueryAction:parseScript()
is modified to acceptObject
parameter.If
Object
is an instance ofMap
then it is a long form ofscript
and old version of this function will be executed.If
Object
is an instance ofString
thenScript
object will be created by usingScript(String)
constructor.All tests are passed or ignored. However,
* What went wrong:
gradle check
is failed with the next message (I think it is not connected with my changesExecution failed for task ':docs:integTestCluster#installAnalysisIcuPlugin'.