-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ElasticsearchClient.Indices.ExistsAsync throws exception if its the first API call. #8304
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
Hi @braveyp, this looks like a regression in the 8.15.1 release. Please downgrade to 8.15.0 until a fix is available. You could help me out here by attaching the JSON response that is returned in case of the ExistsAsync call (without calling any other endpoint first). |
Hi, sorry, I'm not sure how I'd do that - I don't get a response from the ExistsAsync call, I get an exception which doesn't include that information and I can't see a way to get logging from ElasticsearchClient. I'm not familiar with enabling logging on the elastic search server side so any pointers as to how to get the json response would be helpful. |
Hi @braveyp, logging in the client can be enabled by adding these calls to your .DisableDirectStreaming()
.EnableDebugMode(cd =>
{
Console.WriteLine(cd.DebugInformation);
}) Besides that, the full callstack of the exception would be useful for me 🙂 Btw.: Does your |
I changed my code to:
The debug information (though it doesn't include the json request and response data since the internal code seems to think DisableDirectStreaming isn't enabled despite it being explicitly enabled) Successful (404) low level call on HEAD: /test?pretty=true&error_trace=true Audit trail of this API call:
Request:<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on TransportConfiguration to force it to be set on the response.> Response:<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on TransportConfiguration to force it to be set on the response.> TCP states:TimeWait: 208 ThreadPool statistics:Worker: The full stack trace: at Elastic.Clients.Elasticsearch.ElasticsearchClient.<>c__DisplayClass861_0 Lastly, the index does not exist. |
@braveyp Thank you, this is helpful. The JSON is missing, because that specific response does not have a body. The debug output is still useful to e.g. see the status code (404). One last question: How did you set up ES locally? Do you use our docker image or something like that? Did you set any specific config? I'm asking because currently I'm not able to reproduce the issue with my 8.15 cloud instance. |
I just downloaded the latest es and kibana zip files, unzipped them into their own directories and then went through the semi-automated process to get kibana integrated with ES. The only manual config change was that I had to shutdown my ES7 instance before setup, go through the integration process and then go back in and edit the configs to switch the port numbers to avoid conflicts with the ES7 versions. I've not restarted my ES7 instance since though so that shouldn't be the issue. |
Just to confirm the workaround, I created another test project to run the same test using Elastic.Clients.ElasticSearch 8.15.0 instead of 8.15.1 and the call succeeds. The call also succeeds under 8.15.1 if the index actually exists. |
@braveyp Thanks for confirming this as well. It seems like the on-premise version does not send a required HTTP header, if the status code is not in the 200 range. I'm currently investigating this in detail and will create patch as soon as possible. |
@braveyp Should be fixed in 8.15.2. Please let me know, if this release resolves your issue. |
Thanks, that's resolved the issue. |
Elastic.Clients.Elasticsearch version: 8.15.1
Elasticsearch version: 8.15.0
.NET runtime version: 4.8
Operating system version: Windows11
Description of the problem including expected versus actual behavior:
If you instantiate a new ElasticsearchClient and make a call to Indices.ExistsAsync it fails with an error:
Elastic.Clients.Elasticsearch.UnsupportedProductException: The client noticed that the server is not a supported distribution of Elasticsearch or an unknown product.
If you precede the Indices.ExistsAsync call with a Cluster.HealthCheckAsync call the ExistsAsync call succeeds.
Steps to reproduce:
I created a brand new 8.15 install of elastic search and kibana having stopped my 7.16.x ES running on 9200.
This fails:
This succeeds:
I've not tested with any other API call.
Expected behavior
I wouldn't expect to have to make another API call before the ExistsAsync works.
The text was updated successfully, but these errors were encountered: