Get raw query from NEST client

前端 未结 8 706
太阳男子
太阳男子 2021-01-30 08:33

Is it possible to get the raw search query from the NEST client?

var result = client.Search(s => s
             


        
相关标签:
8条回答
  • 2021-01-30 09:06

    on nest version 6 use

    connextionString.DisableDirectStreaming();
    

    then on response.DebugInformation you can see all information.

    0 讨论(0)
  • 2021-01-30 09:11

    The methods to do this seem to change with each major version, hence the confusing number of answers. If you want this to work in NEST 6.x, AND you want to see the deserialized request BEFORE it's actually sent, it's fairly easy:

    var json = elasticClient.RequestResponseSerializer.SerializeToString(request);
    

    If you're debugging in Visual Studio, it's handy to put a breakpoint right after this line, and when you hit it, hover over the json variable above and hit the magnifying glass thingy. You'll get a nice formatted view of the JSON.

    0 讨论(0)
提交回复
热议问题