-
Couldn't load subscription status.
- Fork 1.2k
Description
[Elastic.Clients.Elasticsearch 9.0.7] Invalid media-type value on headers [Content-Type, Accept] when using ES 8.13.x
Elastic.Clients.Elasticsearch version: 9.0.7
Elasticsearch version: 8.13.4 (Docker)
.NET runtime version: .NET 9 — also tested with .NET 8
Operating system version: Windows 11 + Linux (Docker container)
Description of the problem including expected versus actual behavior:
When using Elastic.Clients.Elasticsearch v9.0.7 to interact with an Elasticsearch 8.13.4 cluster, all operations like IndexAsync, SearchAsync, and PingAsync fail with the following error:
Invalid media-type value on headers [Content-Type, Accept]
Expected behavior: the client should send the appropriate headers (Content-Type: application/vnd.elasticsearch+json;compatible-with=8) automatically or provide a way to configure them.
Steps to reproduce:
- Use Elastic.Clients.Elasticsearch v9.0.7
- Connect to an Elasticsearch 8.13.4 cluster
- Try to run
IndexAsyncorSearchAsync - Observe the media-type header error
Expected behavior
All operations should succeed if Elasticsearch is reachable. The client should default to setting proper Accept and Content-Type headers or expose a configuration API (like .DefaultMimeType(...)).
Provide ConnectionSettings:
var settings = new ElasticsearchClientSettings(new Uri("http://elasticsearch:9200"))
.DefaultIndex("logservice-logs")
.DefaultFieldNameInferrer(p => p.ToLowerInvariant())
.DisableDirectStreaming()
.EnableDebugMode()
.PrettyJson();Provide DebugInformation:
Elastic write failed: Log yazılamadı., Invalid media-type value on headers [Content-Type, Accept]
Elastic query failed: Invalid media-type value on headers [Content-Type, Accept]
HealthCheck failed: elastic_ping_check → Unhealthy (Invalid media-type header)