问题
I am on updating to the latest Nest version. Since I am getting not the expected results I am searching for replacement of the EnableTrace() method which was a method of ConnectionSettings on previous versions.
回答1:
EnableTrace() will be back, but it's not available yet(have a look).
For now you can use this code to print out information about request and response:
var settings = new ConnectionSettings(connectionPool)
.DefaultIndex(indexName)
.DisableDirectStreaming()
.OnRequestCompleted(details =>
{
Debug.WriteLine("### ES REQEUST ###");
if(details.RequestBodyInBytes != null) Debug.WriteLine(Encoding.UTF8.GetString(details.RequestBodyInBytes));
Debug.WriteLine("### ES RESPONSE ###");
if (details.ResponseBodyInBytes != null) Debug.WriteLine(Encoding.UTF8.GetString(details.ResponseBodyInBytes));
})
.PrettyJson();
Make sure you have set .DisableDirectStreaming() on ConnectionSettings.
Hope it helps.
来源:https://stackoverflow.com/questions/35554890/nest-2-0-enable-trace