Hello! I'm writing a program using .NET 6.0 and NEST 7.17.2 to import a bunch of data into Elasticsearch
But whenever I try to import any data with
Index I always run into the same exception
service_1 | Invalid NEST response built from a unsuccessful () low level call on PUT: /elasticsearch/data/_doc/1 service_1 | # Audit trail of this API call: service_1 | -  ProductCheckOnStartup: Took: 00:00:00.8917764 service_1 | -  ProductCheckFailure: Node: http://proxy/elasticsearch/ Took: 00:00:00.8756822 service_1 | # OriginalException: Elasticsearch.Net.ElasticsearchClientException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product. Call: Status code 200 from: GET /elasticsearch/ service_1 | ---> Elasticsearch.Net.PipelineException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product. service_1 | at Elasticsearch.Net.RequestPipeline.ThrowIfTransientProductCheckFailure() service_1 | at Elasticsearch.Net.RequestPipeline.Ping(Node node) service_1 | at Elasticsearch.Net.Transport`1.Ping(IRequestPipeline pipeline, Node node) service_1 | at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters) service_1 | --- End of inner exception stack trace --- service_1 | # Request: service_1 | <Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.> service_1 | # Response: service_1 | service_1 |
The Elasticsearch node is hosted behind a proxy running in the same Docker environment.
The .NET application is running inside an Alpine linux Docker container.
The following code is what I use to attempt to insert:
var settings = new ConnectionSettings(new Uri("http://proxy:80/elasticsearch")) .DisableDirectStreaming() .BasicAuthentication("elastic", "DkIedPPSCb") .EnableApiVersioningHeader(); var client = new ElasticClient(settings); Console.WriteLine("Elastic Client connected..."); IEnumerable<Data> DataEnumerator = GetDataEnumerator(data_file); Console.WriteLine(JsonSerializer.Serialize(DataEnumerator.First())); var response = client.Index(DataEnumerator.First(), i => i.Index("data")); Console.WriteLine(response.DebugInformation); Console.WriteLine(response.Result.ToString());
Some data I've discovered along the way from debugging:
Accept header is always set to
which is invalid as the server expects either a 8 or a 7, if I overwrite the header using nginx I get the error above, without nginx proxying the request the only thing that changes is the HTTP Status Code, from 200 -> 400 (but same error always).
I've also tried using different versions of NEST (all versions between 7.17.0 -> 7.17.2)
Wireshark screenshot of request + response
I'm simply not sure what I can do at this point to get it working.