-
Notifications
You must be signed in to change notification settings - Fork 49
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] How can I currently change the default ApiUrls ? #637
Comments
There's an example of customizing an URL in https://github.com/opensearch-project/opensearch-net/blob/main/USER_GUIDE.md#connecting-1, please let us know if that's not sufficient? For faster response, a better place to ask questions is the public slack #client channel. |
I do can change with the ConnectionSettings the server base url but I couln't find a way to customize the URL path for search; or any operation in general; for example:
The Search url will be and it needed to be
I am looking a way to do an interceptor or a DelegatingHandler to change or remap the URL but I dont find a way. The reason of this feature is because we have an OpenSearch service provider that customized their urls. |
I’ll reopen the issue. Why do you need to remap the URL? |
We have this service provider who recently migrated from ElasticSearch to OpenSearch and they will maintain their previous URLs to keep compatibility as much as possible:
So for example when we search by Customers; we need to send the POST to:
this is different from the standard search endpoint "{index}/_search" that will result in:
|
The only real way to achieve this with the client is to use the raw HTTP request API, e.g.: var searchResp = await client.Http.PostAsync<SearchResponse<TheDocument>>(
$"/{resource}/search",
r => r.SerializableBody(new
{
query = new
{
match_all = new { }
}
})); |
We are currently start working in this way, but definetely having support to customize the apiUrls in the High Level version of the library would be a great value, is there any way to attach a delegating handler to the HttpClient used internally? |
@ianido You could try doing something similar to how AWS SigV4 signing is implemented, extending from
You then pass it into |
Great, that is what I needed, thank you so much. |
@ianido Care to paste your working code here for the next person? Or maybe even a working sample? |
I have to connect to a deployed instance of opensearch with different Urls, for example a regular {indexname}/_search is {indexname}search, similar with other features, how can I change this confguration in the Client?
The text was updated successfully, but these errors were encountered: