Since upgrading my Nest client to 2.2.1 I'm unable see the query I'm submitting to my elastic search client (now version 2.3.0). I used to use this line:
string searchJson = Encoding.UTF8.GetString(client.Serializer.Serialize(myQueryHere));
But this method now returns void instead of the JSON it used to. ConnectionStatus also doesn't exist so I can no longer see the json i'm sending, does anyone know of a way? CallDetails.RequestBodyInBytes is available but that returns null.
Take a look at the documentation for NEST 2.x on Connecting. CallDetails.RequestBodyInBytes
will be null
unless you set .DisableDirectStreaming()
on ConnectionSettings
that is passed to the constructor of ElasticClient
var connectionPool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var settings = new ConnectionSettings(connectionPool)
.DisableDirectStreaming();
var client = new ElasticClient(settings);
now a copy of the request and response bytes will be exposed on the response CallDetails
var response = client.Search<Document>();
var requestJson = Encoding.UTF8.GetString(response.CallDetails.RequestBodyInBytes);
var responseJson = Encoding.UTF8.GetString(response.CallDetails.ResponseBodyInBytes);
Whilst developing it may be useful to log out all requests and responses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With