[ML] Perform query field validation for rerank task type#137219
Merged
jonathan-buttner merged 6 commits intoelastic:mainfrom Oct 28, 2025
Merged
[ML] Perform query field validation for rerank task type#137219jonathan-buttner merged 6 commits intoelastic:mainfrom
jonathan-buttner merged 6 commits intoelastic:mainfrom
Conversation
Collaborator
|
Hi @jonathan-buttner, I've created a changelog YAML for you. |
Collaborator
|
Pinging @elastic/ml-core (Team:ML) |
DonalEvans
approved these changes
Oct 27, 2025
Contributor
DonalEvans
left a comment
There was a problem hiding this comment.
Just a couple of minor points, not mandatory
Comment on lines
897
to
912
| String responseJson = """ | ||
| { | ||
| "index": "d0760819-5a73-4d58-b163-3956d3648b62", | ||
| "results": [ | ||
| ], | ||
| "meta": { | ||
| "api_version": { | ||
| "version": "1" | ||
| }, | ||
| "billed_units": { | ||
| "search_units": 1 | ||
| } | ||
| } | ||
| } | ||
| """; | ||
| webServer.enqueue(new MockResponse().setResponseCode(200).setBody(responseJson)); |
Contributor
There was a problem hiding this comment.
This is unnecessary, since the test never actually tries to get a response, as it fails in validation before sending the request.
Comment on lines
994
to
995
| MatcherAssert.assertThat(result.asMap(), Matchers.is(buildExpectationRerank(List.of()))); | ||
| MatcherAssert.assertThat(webServer.requests(), hasSize(1)); |
Contributor
There was a problem hiding this comment.
Nitpick, but this class uses MatcherAssert.assertThat() in a lot of places instead of using ESTestCase.assertThat() (even though they're the same under the hood). Would it improve consistency to do a quick find/replace to remove the MatcherAssert. and have all assertions using the same assertThat() method?
…buttner/elasticsearch into ml-fix-rerank-query-validation
DonalEvans
approved these changes
Oct 28, 2025
This was referenced Oct 28, 2025
jonathan-buttner
added a commit
to jonathan-buttner/elasticsearch
that referenced
this pull request
Oct 28, 2025
) * Validating that query is defined for rerank task * Validation for completion works without query field * Update docs/changelog/137219.yaml * Addressing feedback * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> (cherry picked from commit 34145ed) # Conflicts: # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/SenderServiceTests.java # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/cohere/CohereServiceTests.java
Contributor
Author
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
elasticsearchmachine
pushed a commit
that referenced
this pull request
Oct 28, 2025
…) (#137292) * Fixing merge error * Fixing import
elasticsearchmachine
pushed a commit
that referenced
this pull request
Oct 28, 2025
…) (#137293) * [ML] Perform query field validation for rerank task type (#137219) * Validating that query is defined for rerank task * Validation for completion works without query field * Update docs/changelog/137219.yaml * Addressing feedback * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> (cherry picked from commit 34145ed) # Conflicts: # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/SenderServiceTests.java # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/cohere/CohereServiceTests.java * Fixing tests
elasticsearchmachine
pushed a commit
that referenced
this pull request
Oct 29, 2025
) (#137294) * [ML] Perform query field validation for rerank task type (#137219) * Validating that query is defined for rerank task * Validation for completion works without query field * Update docs/changelog/137219.yaml * Addressing feedback * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> (cherry picked from commit 34145ed) # Conflicts: # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/SenderServiceTests.java # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/cohere/CohereServiceTests.java * Fixing merge error * fixing test
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.
Fixes an issue where if a request did not include the task type in the URL, and the
queryfield was not included in the request, a null pointer would be thrown.This PR will have a validation exception be thrown indicating that the query field must be defined for the rerank task type.
Testing
Create inference endpoint
Issue request without task type in URL
That should return with a validation error.