-
Notifications
You must be signed in to change notification settings - Fork 138
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
Move the ml_parameters from XContent to the request parameters to avoid the conflict with search XContent input. #71
Conversation
Signed-off-by: Alex <pengsun@amazon.com>
the conflict with search XContent input. Signed-off-by: Alex <pengsun@amazon.com>
Can you add some input examples to show why we have to move to request parameters? |
Hi Alex, as we discussed, could you also take a look in MLPredictionTaskRequest and make sure the list of ml parameters is handled properly? In writeTo(), if the list is null, writeList() would cause an error. This might also apply to any tasks with the ML parameters list. Thanks! |
Sure, I will submit a separate PR to fix the issue you mentioned. |
Example added to the PR description. |
General question not related with this fix: is it enough to support queries with URL request parameters only? In AD, we support filter in detector. Not sure if we can use similar way to let user pass filter in http body. |
Oh, after this change:
For example, we could run the following request with ml_parameters in HTTP request parameter, and with query in the HTTP request XContent (JSON string)
|
As we discussed offline, suggest to use such JSON format for input
We can write custom logic to parse the input, if we see Put
Approve this PR now to unblock your testing. You can fix this later. |
…id the conflict with search XContent input. (#71) (#77) * Create JvmService instance on demand. Signed-off-by: Alex <pengsun@amazon.com> * Move the ml_parameters from XContent to the request parameters to avoid the conflict with search XContent input. Signed-off-by: Alex <pengsun@amazon.com> Co-authored-by: Alex <pengsun@amazon.com> Co-authored-by: Alex <pengsun@amazon.com>
…id the conflict with search XContent input. (#71) * Create JvmService instance on demand. Signed-off-by: Alex <pengsun@amazon.com> * Move the ml_parameters from XContent to the request parameters to avoid the conflict with search XContent input. Signed-off-by: Alex <pengsun@amazon.com> Co-authored-by: Alex <pengsun@amazon.com>
Description
The training and prediction APIs extends the RestSearchAction, which will check the XContent of the request and try to build search condition based on the XContent.
If we define the ml_parameters through XContent, the SearchSourceBuilder will run failed to build the search source with parsing_exception "Unknown key for a START_OBJECT in [ml_parameters]."
Move the ml_parameters from XContent to the request parameters to avoid the conflict with search XContent input.
For example, before this PR, below is how would the ml_parameters looks like:
After received this request, the RestSearchAction will try to build the search condition based on:
The RestSearchAction will run failed because of it's not a valid search expression, thus the client will get parsing_exception with the reason: "Unknown key for a START_OBJECT in [ml_parameters]"
Issues Resolved
#70
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.