弹性搜索嵌套 6.5.1。如何将原始请求发送到 Elasticsearch

Elasticsearch Nest 6.5.1. How do I get the Raw Request being sent to Elasticsearch

我正在使用 Elasticsearch 6.5.1,希望看到发送到 Elasticsearch 的原始请求。我在我的 ConnectionSettings 上设置了 DisableDirectStreaming,但是在调用 GetAsync 之后 IGetResponse.ApiCall.RequestBodyInBytes 始终为空。但是,ResponseBodyInbytes 没问题。

请有人解释一下我在使用 Elasticsearch Nest 6.5.1 时如何查看 RequestBodyInBytes。

启用 DisableDirectStreaming 后,您可以在每个响应对象的 DebugInformation 中看到发送到 elasticsearch 的请求。 Link to NEST documentation.

希望对您有所帮助。

我相信您还必须在连接设置中调用 EnableDebugMode()

另一种选择是致电

var jsonString = yourclient.RequestResponseSerializer.SerializeToString(yourdescriptor);

在你的描述符上,但我认为 debugMode 更方便。