Nest 2.0启用跟踪 [英] Nest 2.0 enable trace

查看:97
本文介绍了Nest 2.0启用跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在更新到最新的Nest版本.由于没有得到预期的结果,我正在寻找替代EnableTrace()方法的方法,该方法在以前的版本中是ConnectionSettings的方法.

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.

推荐答案

EnableTrace()将返回,但尚不可用(

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();

确保您在ConnectionSettings上设置了.DisableDirectStreaming().

希望有帮助.

这篇关于Nest 2.0启用跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆