简体   繁体   中英

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

I am using Elasticsearch 6.5.1 and would like to see the raw request being sent to Elasticsearch. I have set DisableDirectStreaming on my ConnectionSettings, but after making a GetAsync call the IGetResponse.ApiCall.RequestBodyInBytes is always null. However, the ResponseBodyInbytes is fine.

Please can someone explain how I can see the RequestBodyInBytes when using Elasticsearch Nest 6.5.1.

You can see the request being sent to elasticsearch in DebugInformation of every response object once DisableDirectStreaming is enabled. Link to NEST documentation .

Hope that helps.

I believe you also have to call EnableDebugMode() on your connection settings.

Another option would be to call

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

on your descriptor, but debugMode is alot more convenient in my opinion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM