-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Relative Uri building removes path from root #3691
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
Comments
Thank you very much for reporting this! We changed url building in 7.0 alpha but your usecase is definitely one we have to support and always have done in the past. I'm surprised we did not have a unit test to cover this will look into how this snuck through. |
russcam
added a commit
that referenced
this issue
Apr 29, 2019
This commit updates the API generator to trim the leading forward slashes from all API paths. When the base URI with which the API path will be combined also contains a relative path, the relative path should be respected in the combined URI output. Fixes #3691
russcam
added a commit
that referenced
this issue
Apr 29, 2019
This commit updates the API generator to trim the leading forward slashes from all API paths. When the base URI with which the API path will be combined also contains a relative path, the relative path should be respected in the combined URI output. Fixes #3691
I've merged in #3700 to address in the next alpha release. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
NEST/Elasticsearch.Net version:
7.0.0
Elasticsearch version:
7.0.0
Description of the problem including expected versus actual behavior:
We have elasticsearch located not in the root of url but in some folder. Almost real example: http://site.com/elasticsearch/ . When we try to make Search request with ElasticClient we are getting 404 error because somehow library uses absolute url( http://site.com/{index}/_search?... )
Where this problem appers
src/Elasticsearch.Net/Transport/Pipeline/RequestData.cs
line with
public Uri Uri => Node != null ? new Uri(Node.Uri, PathAndQuery) : null;
As per microsoft documentation of new Uri(Uri,string) in Remarks section
And so, because SearchDescriptor creates /{index}/_search pattern - it will replace my /elasticsearch/ in Uri. Possible solutions are change of Uri construction or editing of PathAndQuery variable.
Steps to reproduce:
var node = new Uri("http://site.com/elasticsearch");
var settings = new ConnectionSettings(node);
var client = new ElasticClient(settings);
Provide
DebugInformation
(if relevant):DebugInformation of ISearchResponse
Invalid NEST response built from a unsuccessful low level call on POST: /myindex/_search?typed_keys=true&ignore_unavailable=true
Audit trail of this API call:
OriginalException: Elasticsearch.Net.ElasticsearchClientException: Request failed to execute. Call: Status code 404 from: POST /myindex/_search?typed_keys=true&ignore_unavailable=true. ServerError: Type: Reason: "Not Found"
Request:
{"query":{"bool":{"filter":[{"range":{"create_time":{"gte":"2019-04-22T00:00:00","lt":"2019-04-22T00:01:00"}}}],"must":[{"query_string":{"analyze_wildcard":true,"query":"*"}}]}},"size":5000}
Response:
{"statusCode":404,"error":"Not Found","message":"Not Found"}
OriginalException.DebugInformation (exactly here we can see full generated url)
FailureReason: BadResponse while attempting POST on http://site.com/myindex/_search?typed_keys=true&ignore_unavailable=true
Audit trail of this API call:
OriginalException: Elasticsearch.Net.ElasticsearchClientException: Request failed to execute. Call: Status code 404 from: POST /myindex/_search?typed_keys=true&ignore_unavailable=true. ServerError: Type: Reason: "Not Found"
Request:
{"query":{"bool":{"filter":[{"range":{"create_time":{"gte":"2019-04-22T00:00:00","lt":"2019-04-22T00:01:00"}}}],"must":[{"query_string":{"analyze_wildcard":true,"query":"*"}}]}},"size":5000}
Response:
{"statusCode":404,"error":"Not Found","message":"Not Found"}
Exception:
Elasticsearch.Net.ElasticsearchClientException: Request failed to execute. Call: Status code 404 from: POST /myindex/_search?typed_keys=true&ignore_unavailable=true. ServerError: Type: Reason: "Not Found"
Edit: Sorry for bad title and formating. This is literally my first report in github.
The text was updated successfully, but these errors were encountered: