IElasticClient.CatHealth() works OK locally, but fails in json parsing when talking to elastic cloud instance

Hi this is a known issue:

Elastic Cloud strips the accept header and NEST wants the cat data in json form.

You can use the lowlevel cat API instead to circumvent the problem

var client = new ElasticClient(new Uri("http://localhost:9200"));
var catHealth = client.LowLevel.CatHealth<string>();
//catHealth.Body will hold the string as returned by default by elasticsearch

or just use the .ClusterHealth() endpoint to get the same information in a more typed fashion

var clusterHealth = client.ClusterHealth();
1 Like