# Is there a way not set the document type when doing search?

**URL:** https://discuss.elastic.co/t/is-there-a-way-not-set-the-document-type-when-doing-search/94042
**Category:** Elasticsearch
**Created:** [July 21, 2017, 1:54am UTC](https://discuss.elastic.co/t/is-there-a-way-not-set-the-document-type-when-doing-search/94042 "2017-07-21T01:54:05Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![MountainMoon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mountainmoon/32/125700_2.png) [@MountainMoon](https://discuss.elastic.co/u/MountainMoon)
#### Post date: [July 21, 2017, 1:54am UTC](https://discuss.elastic.co/t/is-there-a-way-not-set-the-document-type-when-doing-search/94042/1 "2017-07-21T01:54:05Z")

</div>

What I'm trying to do now is I would like to search two document types in two indices. But in C#, Nest, you need you add a in the search function like this "Client.Search". Since there are different types when search this type on the other indices gives no result set. Is there a way to search in the following url?  
[http://ess01:9200/indexa,indexb/\_search](http://ess01:9200/indexa,indexb/_search)  
Notice that no type is set. I tried to fire a query to the above endpoint and it works well. But I could not find a way to do it in C#. Any idea will be appreciated!

---

<div class="post-metadata">

### Author: ![Martijn\_Laarman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/martijn_laarman/32/4410_2.png) [@Martijn\_Laarman](https://discuss.elastic.co/u/Martijn_Laarman)
#### Post date: [July 21, 2017, 3:08pm UTC](https://discuss.elastic.co/t/is-there-a-way-not-set-the-document-type-when-doing-search/94042/2 "2017-07-21T15:08:15Z")

</div>

`client.Search<Document>(s=>s.Index("indexa,indexb"))` will search both indices and map it to `Document`

`.Index(Indices.Index("indexa", "indexb"))` is a slightly longer version to do it.

Be sure to read [https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/covariant-search-results.html](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/covariant-search-results.html)

To understand how NEST can help searching multiple different json sources and map it to covariant list response.

---

<div class="post-metadata">

### Author: ![MountainMoon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mountainmoon/32/125700_2.png) [@MountainMoon](https://discuss.elastic.co/u/MountainMoon)
#### Post date: [July 21, 2017, 6:12pm UTC](https://discuss.elastic.co/t/is-there-a-way-not-set-the-document-type-when-doing-search/94042/3 "2017-07-21T18:12:33Z")

</div>

Thank you so much!

---

<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: [August 18, 2017, 6:12pm UTC](https://discuss.elastic.co/t/is-there-a-way-not-set-the-document-type-when-doing-search/94042/4 "2017-08-18T18:12:35Z")

</div>

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