# In Elasticsearch client for .NET v8.x, how to check if SearchRequest object contains an index to target?

**URL:** https://discuss.elastic.co/t/in-elasticsearch-client-for-net-v8-x-how-to-check-if-searchrequest-object-contains-an-index-to-target/354357
**Category:** Elasticsearch
**Tags:** language-clients
**Created:** [February 28, 2024, 3:03pm UTC](https://discuss.elastic.co/t/in-elasticsearch-client-for-net-v8-x-how-to-check-if-searchrequest-object-contains-an-index-to-target/354357 "2024-02-28T15:03:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![yansklyarenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yansklyarenko/32/125805_2.png) [@yansklyarenko](https://discuss.elastic.co/u/yansklyarenko)
#### Post date: [February 28, 2024, 3:03pm UTC](https://discuss.elastic.co/t/in-elasticsearch-client-for-net-v8-x-how-to-check-if-searchrequest-object-contains-an-index-to-target/354357/1 "2024-02-28T15:03:40Z")

</div>

When creating a SearchRequest object, there's an option to provide an index name. However, it is optional, and if not provided, a default index is taken, etc.

In my code, I need to be absolutely sure the object is created with index name. How to I check this? There's no property for that, as far as I can see.

---

<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: [March 27, 2024, 3:04pm UTC](https://discuss.elastic.co/t/in-elasticsearch-client-for-net-v8-x-how-to-check-if-searchrequest-object-contains-an-index-to-target/354357/2 "2024-03-27T15:04:28Z")

</div>

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