# NET Client: Serialisation of descriptor objects (e.g. QueryDescriptor)

**URL:** https://discuss.elastic.co/t/net-client-serialisation-of-descriptor-objects-e-g-querydescriptor/380257
**Category:** Elasticsearch
**Tags:** language-clients
**Created:** [July 18, 2025, 12:16pm UTC](https://discuss.elastic.co/t/net-client-serialisation-of-descriptor-objects-e-g-querydescriptor/380257 "2025-07-18T12:16:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![JanSearch](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@JanSearch](https://discuss.elastic.co/u/JanSearch)
#### Post date: [July 18, 2025, 12:16pm UTC](https://discuss.elastic.co/t/net-client-serialisation-of-descriptor-objects-e-g-querydescriptor/380257/1 "2025-07-18T12:16:06Z")

</div>

Dear Elastic forum,

we used NEST so far and are going to switch to the new client.

In NEST it is possible to serialise the descriptor objects, e.g. QueryContainerDescriptor or CreateIndexDescriptor.

In the new NET client I did not find out how to do this, for example for QueryDescriptor. A Query can be serialised to JSON, but not the QueryDescriptor. I use the method ElasticsearchClientSettings.SourceSerializer.Serialize which seems to be the right one.

The reason for serialising queries is that we like to check them in an API before they will be send to Elasticsearch.

I guess that the Elasticsearch client has to serialise these objects. Is it possible that serialisation for descriptor objects does only work internally (inside the client) or am I doing something wrong?

Thanks in advance for any help

Jan

---

<div class="post-metadata">

### Author: ![flobernd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flobernd/32/124877_2.png) [@flobernd](https://discuss.elastic.co/u/flobernd)
#### Post date: [July 18, 2025, 6:30pm UTC](https://discuss.elastic.co/t/net-client-serialisation-of-descriptor-objects-e-g-querydescriptor/380257/2 "2025-07-18T18:30:55Z")

</div>

Hi @JanSearch,

which version of the client are you using?

---

<div class="post-metadata">

### Author: ![JanSearch](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@JanSearch](https://discuss.elastic.co/u/JanSearch)
#### Post date: [July 22, 2025, 5:18pm UTC](https://discuss.elastic.co/t/net-client-serialisation-of-descriptor-objects-e-g-querydescriptor/380257/3 "2025-07-22T17:18:56Z")

</div>

Hi Flobernd,

thank you for your answer!

Currently, I am using the latest version of the 8 client since I try first to switch the client (from NEST 7 to new client 8) and afterwards the server version (from 8 to 9).

Best regards

Jan

---

<div class="post-metadata">

### Author: ![JanSearch](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@JanSearch](https://discuss.elastic.co/u/JanSearch)
#### Post date: [August 4, 2025, 9:21am UTC](https://discuss.elastic.co/t/net-client-serialisation-of-descriptor-objects-e-g-querydescriptor/380257/4 "2025-08-04T09:21:50Z")

</div>

The solution is to use

ElasticsearchClient.ElasticsearchClientSettings.RequestResponseSerializer

instead of

ElasticsearchClient.ElasticsearchClientSettings.SourceSerializer!

It offers the extension "SerializeToString" which works as expected with objects like "CreateIndexDescriptor" or "QueryDescriptor".
