# Nest 2, What happened to ExposeRawResponse and ConnectionStatus?

**URL:** <https://discuss.elastic.co/t/nest-2-what-happened-to-exposerawresponse-and-connectionstatus/46839>\
**Category:** Elasticsearch\
**Created:** [April 8, 2016, 5:58pm UTC](https://discuss.elastic.co/t/nest-2-what-happened-to-exposerawresponse-and-connectionstatus/46839 "2016-04-08T17:58:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gnudle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gnudle/32/9006_2.png) [@gnudle](https://discuss.elastic.co/u/gnudle)\
**Post date:** [April 8, 2016, 5:58pm UTC](https://discuss.elastic.co/t/nest-2-what-happened-to-exposerawresponse-and-connectionstatus/46839/1 "2016-04-08T17:58:45Z")

</div>

Prior to 2.0 it was possible to set ExposeRawResponse on the ConnectionSettings to keep a copy of the raw response on the result object for debugging. In addition, on the result object you could inspect ConnectionSettings to see the response.

Both of these methods are missing now and there's nothing in the documentation.

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [April 9, 2016, 7:50am UTC](https://discuss.elastic.co/t/nest-2-what-happened-to-exposerawresponse-and-connectionstatus/46839/2 "2016-04-09T07:50:53Z")

</div>

`ExposeRawResponse` is now `DisableDirectStreaming`.

The [documentation for NEST 2.x on Connecting](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/connecting.html#complex-logging) provides an example of configuring inspection of all requests and responses using `OnRequestCompleted`

```auto
var connectionPool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));

var settings = new ConnectionSettings(connectionPool, new InMemoryConnection()) 
    .DefaultIndex("default-index")
    .DisableDirectStreaming()
    .OnRequestCompleted(response =>
    {
        // log out the request and the request body, if one exists for the type of request
        if (response.RequestBodyInBytes != null)
        {
            Console.WriteLine(
                $"{response.HttpMethod} {response.Uri} \n" +
                $"{Encoding.UTF8.GetString(response.RequestBodyInBytes)}");
        }
        else
        {
            Console.WriteLine($"{response.HttpMethod} {response.Uri}");
        }

        // log out the response and the response body, if one exists for the type of response
        if (response.ResponseBodyInBytes != null)
        {
            Console.WriteLine($"Status: {response.HttpStatusCode}\n" +
                     $"{Encoding.UTF8.GetString(response.ResponseBodyInBytes)}\n" +
                     $"{new string('-', 30)}\n");
        }
        else
        {
            Console.WriteLine($"Status: {response.HttpStatusCode}\n" +
                     $"{new string('-', 30)}\n");
        }
    });

var client = new ElasticClient(settings);

```

If you just want to inspect the response ad-hoc, then set `DisableDirectStreaming` and then get the string from the response body bytes

```auto
Encoding.UTF8.GetString(response.ResponseBodyInBytes)

```

---

<div class="post-metadata">

**Author:** ![gnudle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gnudle/32/9006_2.png) [@gnudle](https://discuss.elastic.co/u/gnudle)\
**Post date:** [April 9, 2016, 11:51pm UTC](https://discuss.elastic.co/t/nest-2-what-happened-to-exposerawresponse-and-connectionstatus/46839/3 "2016-04-09T23:51:17Z")

</div>

Awesome, thank you. And thanks for the documentation link. I was still using the old one at [http://nest.azurewebsites.net/](http://nest.azurewebsites.net/)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:00pm UTC](https://discuss.elastic.co/t/nest-2-what-happened-to-exposerawresponse-and-connectionstatus/46839/4 "2017-07-05T23:00:55Z")

</div>


