[ML] Remove unsupported project_routing from clear job audit messages - #288210
Merged
wildemat merged 2 commits intoSep 1, 2026
Merged
Conversation
The update_by_query and index APIs do not accept project_routing. The ES client forwards unrecognised parameters into the request body, so passing it made update_by_query fail with a parsing_exception and silently added a stray field to the indexed notification document. Closes elastic/sdh-kibana#6491 Co-authored-by: Cursor <cursoragent@cursor.com>
|
Pinging @elastic/ml-ui (:ml) |
Co-authored-by: Cursor <cursoragent@cursor.com>
8 tasks
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
Test Failures
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Clearing ML anomaly detection job notifications fails with an HTTP 400 on serverless projects with CPS enabled:
clearJobAuditMessagespassedproject_routingintoasInternalUser.updateByQuery(...)andasInternalUser.index(...). Neither Elasticsearch API accepts that parameter, and the ES client just forwarded the unrecognized params.update_by_query: 400 when this function sendsproject_routingto ES query bodyindex:project_routingwas just written into the_sourceof the index's documents for this case. So index documents up until now that have hit this issue don't need to be cleaned up.The three
searchcalls in the same file keep theirproject_routing, because they declareproject_routinginacceptedParamsCore's CPS request handler already injects
project_routingautomatically for APIs that accept it (acceptedParams). Removing these manual spreads won't regress anything.Type issue
Typecheck didn't catch it because conditional spread operator doesn't trip excess property check.
UpdateByQueryRequestandIndexRequestdo not declareproject_routing;SearchRequest,FieldCapsRequestandMsearchRequestdo.Testing
New
job_audit_messages.test.tswith three cases:updateByQueryreceives noproject_routing.indexreceives noproject_routing, on params or the document body.searchstill receivesproject_routingTwo new tests failed on latest
mainchanges and passed after these changes.Closes https://github.com/elastic/sdh-kibana/issues/6491
Regression introduced by #251270
Checklist
release_note:*label is applied per the guidelinesbackport:*labels.Not applicable: no user-facing text (no i18n), no documentation changes, no plugin configuration keys, no HTTP API changes, no existing tests changed (only new tests added, so no Flaky Test Runner run).
Identify risks
Low risk. This removes a parameter that the two affected Elasticsearch APIs never accepted, and which Core injects automatically where it is accepted.
Made with Cursor, further reviewed and edited by @wildemat