-
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
Added deprecation warning for rescore in scroll queries #33070
Added deprecation warning for rescore in scroll queries #33070
Conversation
Pinging @elastic/es-search-aggs |
I'm not sure what the correct version tag to put on this PR is. |
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.
It looks good to me overall, a couple comments:
- It would be great to add a test for the deprecation logging using
ESTestCase#assertWarnings
. - As we did for 7.0.0, we can add a small note to
migration_6_5.asciidoc
explaining the deprecation.
It might be helpful to look at #30157 as an example of adding a test + migration notes. As for the PR label, I think we can just add 6.5.0
.
@@ -137,6 +137,10 @@ public ActionRequestValidationException validate() { | |||
if (source != null && source.size() == 0 && scroll != null) { | |||
validationException = addValidationError("[size] cannot be [0] in a scroll context", validationException); | |||
} | |||
if (source != null && source.rescores() != null && source.rescores().isEmpty() == false && scroll != null) { | |||
DEPRECATION_LOGGER.deprecated("Using [rescore] for a scroll query is deprecated and will return a 400 error in future " + |
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.
It would be nice to mention that the rescore will be ignored, as that may not be clear to the user only from the fact it's deprecated.
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.
A couple last comments.
{ | ||
// Rescore is deprecated on scroll requests | ||
SearchRequest searchRequest = createSearchRequest().source(new SearchSourceBuilder()); | ||
searchRequest.source().addRescorer(new NoOpRescorerBuilder()); |
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.
Instead of creating a new builder class, I think we could do something like new QueryRescorerBuilder(QueryBuilders.matchAllQuery()));
.
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.
maybe this could also be done on the other PR which will go to master and save us some lines of code there too ;)
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.
@jtibshirani Thanks for pointing this out to me, that's exactly what I needed, and failed to find!
@@ -180,6 +180,11 @@ In prior versions the source field names were relative to the inner hit. | |||
The `from` parameter can no longer be used in the search request body when initiating a scroll. | |||
The parameter was already ignored in these situations, now in addition an error is thrown. | |||
|
|||
Using `rescore` with a scroll query now raises a deprecation warning and |
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 think this note should instead go in migrate_6_5.asciidoc
.
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.
left a couple of minor comments, LGTM otherwise
@@ -180,6 +180,11 @@ In prior versions the source field names were relative to the inner hit. | |||
The `from` parameter can no longer be used in the search request body when initiating a scroll. | |||
The parameter was already ignored in these situations, now in addition an error is thrown. | |||
|
|||
Using `rescore` with a scroll query now raises a deprecation warning and | |||
ignores the parameter. In earlier 6.x releases, rescore on scroll queries was | |||
silently ignored. In future versions, including we will return a `400 - Bad |
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.
be more specific on when? next major version? Say "From 7.0 on, a 400 - Bad Request
will be returned instead.
@@ -137,6 +137,10 @@ public ActionRequestValidationException validate() { | |||
if (source != null && source.size() == 0 && scroll != null) { | |||
validationException = addValidationError("[size] cannot be [0] in a scroll context", validationException); | |||
} | |||
if (source != null && source.rescores() != null && source.rescores().isEmpty() == false && scroll != null) { | |||
DEPRECATION_LOGGER.deprecated("Using [rescore] for a scroll query is deprecated and will be ignored. Future versions will " + |
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.
shall we be more specific on when this will become a hard error?
{ | ||
// Rescore is deprecated on scroll requests | ||
SearchRequest searchRequest = createSearchRequest().source(new SearchSourceBuilder()); | ||
searchRequest.source().addRescorer(new NoOpRescorerBuilder()); |
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.
maybe this could also be done on the other PR which will go to master and save us some lines of code there too ;)
retest this please |
Conflicts: docs/reference/migration/migrate_6_5.asciidoc
* 6.x: Mute test watcher usage stats output [Rollup] Fix FullClusterRestart test TEST: Disable soft-deletes in ParentChildTestCase TEST: Disable randomized soft-deletes settings Integrates soft-deletes into Elasticsearch (#33222) drop `index.shard.check_on_startup: fix` (#32279) Fix AwaitsFix issue number Mute SmokeTestWatcherWithSecurityIT testsi [DOCS] Moves ml folder from x-pack/docs to docs (#33248) TEST: mute more SmokeTestWatcherWithSecurityIT tests [DOCS] Move rollup APIs to docs (#31450) [DOCS] Rename X-Pack Commands section (#33005) Fixes SecurityIntegTestCase so it always adds at least one alias (#33296) TESTS: Fix Random Fail in MockTcpTransportTests (#33061) (#33307) MINOR: Remove Dead Code from PathTrie (#33280) (#33306) Fix pom for build-tools (#33300) Lazy evaluate java9home (#33301) SQL: test coverage for JdbcResultSet (#32813) Work around to be able to generate eclipse projects (#33295) Different handling for security specific errors in the CLI. Fix for #33230 (#33255) [ML] Refactor delimited file structure detection (#33233) SQL: Support multi-index format as table identifier (#33278) Enable forbiddenapis server java9 (#33245) [MUTE] SmokeTestWatcherWithSecurityIT flaky tests Add region ISO code to GeoIP Ingest plugin (#31669) (#33276) Don't be strict for 6.x Update serialization versions for custom IndexMetaData backport Replace IndexMetaData.Custom with Map-based custom metadata (#32749) Painless: Fix Bindings Bug (#33274) SQL: prevent duplicate generation for repeated aggs (#33252) TEST: Mute testMonitorClusterHealth Fix serialization of empty field capabilities response (#33263) Fix nested _source retrieval with includes/excludes (#33180) [DOCS] TLS file resources are reloadable (#33258) Watcher: Ensure TriggerEngine start replaces existing watches (#33157) Ignore module-info in jar hell checks (#33011) Fix docs build after #33241 [DOC] Repository GCS ADC not supported (#33238) Upgrade to latest Gradle 4.10 (#32801) Fix/30904 cluster formation part2 (#32877) Move file-based discovery to core (#33241) HLRC: add client side RefreshPolicy (#33209) [Kerberos] Add unsupported languages for tests (#33253) Watcher: Reload properly on remote shard change (#33167) Fix classpath security checks for external tests. (#33066) [Rollup] Only allow aggregating on multiples of configured interval (#32052) Added deprecation warning for rescore in scroll queries (#33070) Apply settings filter to get cluster settings API (#33247) [Rollup] Re-factor Rollup Indexer into a generic indexer for re-usability (#32743) HLRC: create base timed request class (#33216) HLRC: Use Optional in validation logic (#33104) Painless: Add Bindings (#33042)
This adds a deprecation warning for using rescore on scroll queries in 6.x. As per #31775 we will not be supporting this going forward.
See also #32918 which implements the validation error for 7.0