# Preserve index when serializing and de-serializing search request

**URL:** https://discuss.elastic.co/t/preserve-index-when-serializing-and-de-serializing-search-request/69498
**Category:** Elasticsearch
**Created:** [December 19, 2016, 9:45pm UTC](https://discuss.elastic.co/t/preserve-index-when-serializing-and-de-serializing-search-request/69498 "2016-12-19T21:45:28Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tenhavenator](https://avatars.discourse-cdn.com/v4/letter/t/c2a13f/32.png) [@tenhavenator](https://discuss.elastic.co/u/tenhavenator)
#### Post date: [December 19, 2016, 9:45pm UTC](https://discuss.elastic.co/t/preserve-index-when-serializing-and-de-serializing-search-request/69498/1 "2016-12-19T21:45:28Z")

</div>

Using Nest 2.4.7.

I am trying to store some SearchRequests so they can be used at later time. I am serializing and  
de-serializing with the serializer provided in the client like this:

ElasticClient.Serializer.Serialize(request, stream);  
ElasticClient.Serializer.Deserialize(stream);

When serializing the SearchRequest, the index name is not present in the resultant JSON. Is there a way to preserve the index name when serializing? Or, alternatively, set the index name on a SearchRequest after it has been de-serialized?

---

<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: [January 16, 2017, 9:45pm UTC](https://discuss.elastic.co/t/preserve-index-when-serializing-and-de-serializing-search-request/69498/2 "2017-01-16T21:45:33Z")

</div>

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