-
Notifications
You must be signed in to change notification settings - Fork 187
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
[FEATURE] Add the ability to send REST requests via the client #498
Comments
This happens because without a leading slash the request is performed against the host called resp = client.transport.perform_request(
"GET", "/_plugins/_ml/models/_search", body='{"query": {"match_all":{}}}'
) I made a sample that creates an index and indexes a document in https://github.com/dblock/opensearch-python-client-demo/blob/main/sync/transport.py, that should get you started - feel free to add an Leaving this issue open. I think we want to expose |
@Jon-AtAWS you should check out the github.com/opensearch-project/opensearch-py-ml client it has support for these API's. Generally, I agree though. We should provide a generic helper that allows users to run non-implemented API endpoints. @dblock have you heard any discussion of rolling the ML client into this one? I know there was some talk about allowing different parts to be installed optionally with pip but I cant find that issue. If that was implemented it should make it a more straightforward move. |
@dtaivpp - The py-ml client is in a state of flux right now, and doesn't support many of the operations I needed for my implementation. I ended up falling back to the requests library to manual those. Once I complete my example, I'll publish that somewhere and add a couple improvement ideas to the py-ml client. Having said that, this request is more about a general way to send REST requests (per @dblock above as well). The Dev Tools tab from Dashboards makes it simple to send these requests. I'm looking for something like that in code. |
I have not. Maybe you want to open/find an existing issue? This client has been adding support for various plugins for a while. |
I am able to reuse the @dblock I think the feature is already there. |
I think we still need a DSL, e.g. |
domain specific language - I mean I'd like to write
Absolutely. |
I've opened an umbrella issue to collect this and similar requests across clients, opensearch-project/opensearch-clients#62. |
PR in #544 |
Is your feature request related to a problem?
I'm trying to list out loaded ml models via the python client (different feature request on that). The way to do that is to run a match_all query against _plugins/_ml/models. opensearchpy.search doesn't support setting the path like that. I need a clean way to send the request. More generally, I want something like the "requests" library that supports GET, PUT, POST, etc. by URL and body, but that backs out to the cluster with all of the auth, etc. from the client.
What alternatives have you considered?
Even if the below works, it would be nice to have opensearchpy.search support setting the path and body.
I tried:
But received
The equivalent call via the requests library works fine:
If this is the preferred method, then that needs to be in the documentation somewhere.
The text was updated successfully, but these errors were encountered: