# Does not contain a definition for 'Type' in ASP.NET MVC Elasticsearch

**URL:** https://discuss.elastic.co/t/does-not-contain-a-definition-for-type-in-asp-net-mvc-elasticsearch/247830
**Category:** Elasticsearch
**Tags:** language-clients
**Created:** [September 8, 2020, 7:23am UTC](https://discuss.elastic.co/t/does-not-contain-a-definition-for-type-in-asp-net-mvc-elasticsearch/247830 "2020-09-08T07:23:27Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Zylne](https://avatars.discourse-cdn.com/v4/letter/z/82dd89/32.png) [@Zylne](https://discuss.elastic.co/u/Zylne)
#### Post date: [September 8, 2020, 7:23am UTC](https://discuss.elastic.co/t/does-not-contain-a-definition-for-type-in-asp-net-mvc-elasticsearch/247830/1 "2020-09-08T07:23:27Z")

</div>

I want to create a search on "user" index with [ASP.NET](http://ASP.NET) MVC. DataSearch Action Method:

```auto
public JsonResult DataSearch(string name)  
    {  
        var responsedata = _connectionToEs.EsClient().Search<User>(s => s  
                                .Index("user")  
                                .Type("doc")  
                                .Size(50)  
                                .Query(q => q  
                                    .Match(m => m  
                                        .Field(f => f.name)  
                                        .Query(name)  
                                    )  
                                )  
                            );  
  
        var datasend = (from hits in responsedata.Hits  
                        select hits.Source).ToList();  
  
        return Json(new { datasend, responsedata.Took }, behavior: JsonRequestBehavior.AllowGet);  
    } 

```

I got error in .Type("doc"). Severity Code Description Project File Line Suppression State Error CS1061 'SearchDescriptor' does not contain a definition for 'Type' and no accessible extension method 'Type' accepting a first argument of type 'SearchDescriptor' could be found (are you missing a using directive or an assembly reference?). I already added using [Elasticsearch.Net](http://Elasticsearch.Net); using Nest; using Newtonsoft.Json;. How to fix this problem? Thanks

---

<div class="post-metadata">

### Author: ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)
#### Post date: [September 8, 2020, 12:10pm UTC](https://discuss.elastic.co/t/does-not-contain-a-definition-for-type-in-asp-net-mvc-elasticsearch/247830/2 "2020-09-08T12:10:09Z")

</div>

It sounds like you're using a NEST 7.x version; NEST 7.x does not contain a `.Type()` method as types are deprecated in Elasticsearch and will be removed entirely in a future version.

You can remove the `.Type()` method call; the default document "type" will be `_doc`.

---

<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: [October 6, 2020, 12:10pm UTC](https://discuss.elastic.co/t/does-not-contain-a-definition-for-type-in-asp-net-mvc-elasticsearch/247830/3 "2020-10-06T12:10:12Z")

</div>

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