# NEST, number of transferred bytes when using compression

**URL:** <https://discuss.elastic.co/t/nest-number-of-transferred-bytes-when-using-compression/281991>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [August 19, 2021, 3:31pm UTC](https://discuss.elastic.co/t/nest-number-of-transferred-bytes-when-using-compression/281991 "2021-08-19T15:31:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MPeli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mpeli/32/93469_2.png) [@MPeli](https://discuss.elastic.co/u/MPeli)\
**Post date:** [August 19, 2021, 3:31pm UTC](https://discuss.elastic.co/t/nest-number-of-transferred-bytes-when-using-compression/281991/1 "2021-08-19T15:31:46Z")

</div>

Hi,

I use the [NEST](https://github.com/elastic/elasticsearch-net) library to index documents. Request are made using a BulkAsync function. I enabled an http compression (gzip). I wonder whether it is possible to find out how many bytes were transferred when making a post request. I found a variable `RequestBodyInBytes` but it seems to be uncompressed body.

Thank you, Martin.

---

<div class="post-metadata">

**Author:** ![stevejgordon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stevejgordon/32/80912_2.png) [@stevejgordon](https://discuss.elastic.co/u/stevejgordon)\
**Post date:** [August 20, 2021, 7:56am UTC](https://discuss.elastic.co/t/nest-number-of-transferred-bytes-when-using-compression/281991/2 "2021-08-20T07:56:06Z")

</div>

Hi Martin,

The short answer is that I don't believe there's an easy way to get this information today. You are correct that `RequestBodyInBytes` is the pre-buffered UTF8 JSON bytes useful for diagnostics but would not represent the compressed size. The compression happens lower in transport and uses the underlying HttpClient functionality.

If this is purely needed during development testing you could use a proxy such as Fiddler or a network tool such as WireShark to check the content-length header on requests. If you're on .NET 5+ then you could also look into the latest diagnostics telemetry provided by Microsoft. The sockets telemetry includes a `bytes-sent` counter you could track, although that would be for all sockets used by the application, not just `NEST`. I have a [blog post that demonstrates those](https://www.stevejgordon.co.uk/additional-http-sockets-dns-and-tls-telemetry-in-dotnet-5).

For NEST v8, I'm working on plans to expand the diagnostics and telemetry from the library. I will make sure this use case is captured and whether it can be included somewhere.

It would be great to learn more about your scenario to make sure its considered in any future design.

Steve

---

<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:** [September 17, 2021, 7:56am UTC](https://discuss.elastic.co/t/nest-number-of-transferred-bytes-when-using-compression/281991/3 "2021-09-17T07:56:36Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
