# Upgrade from nest 0.11.0.0 to 5.5.0 Index and delete

**URL:** https://discuss.elastic.co/t/upgrade-from-nest-0-11-0-0-to-5-5-0-index-and-delete/99321
**Category:** Elasticsearch
**Created:** [September 4, 2017, 2:43pm UTC](https://discuss.elastic.co/t/upgrade-from-nest-0-11-0-0-to-5-5-0-index-and-delete/99321 "2017-09-04T14:43:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![LostAtSea](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@LostAtSea](https://discuss.elastic.co/u/LostAtSea)
#### Post date: [September 4, 2017, 2:43pm UTC](https://discuss.elastic.co/t/upgrade-from-nest-0-11-0-0-to-5-5-0-index-and-delete/99321/1 "2017-09-04T14:43:24Z")

</div>

I'm very much a newbie, tasked with upgrading an older service  
Given  
private static ElasticClient ClientCreate(Uri uri)  
{  
var e = new Nest.ElasticClient(new ConnectionSettings(uri));  
return e;  
}

This is no longer valid syntax :  
public void AlertSave(Alert alert)  
{  
var c = ClientCreate(\_uri);  
c.Index(alert,\_indexName );  
}  
public void AlertDelete(Alert alert)  
{  
var c = ClientCreate(\_uri);  
c.Delete(alert,\_indexName);  
}

I got round it by creating the client with a default index - is this a sensible approach? is there a better one?  
private static ElasticClient ClientCreate(Uri uri, string index)  
{  
var e = new Nest.ElasticClient(new ConnectionSettings(uri).DefaultIndex(index));  
return e;  
}  
public void AlertSave(Alert alert)  
{  
var c = ClientCreate(\_uri, \_indexName);  
c.Index(alert);  
}  
etc

---

<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 5, 2017, 12:23am UTC](https://discuss.elastic.co/t/upgrade-from-nest-0-11-0-0-to-5-5-0-index-and-delete/99321/2 "2017-09-05T00:23:21Z")

</div>

Please edit your question and format your code with `</>` button.

> [@LostAtSea](#):
>
> I got round it by creating the client with a default index - is this a sensible approach? is there a better one?

The default index is used if no index is specified on the request, and no index can be inferred for the type; [check out the options for how an index name can be inferred](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/index-name-inference.html). Usually, I tend to set up indices and type names to use for specific C# POCOs, using `InferMappingFor<T>()` on `ConnectionSettings`.

Also take a look at [how an index name can be specified, using strings, C# types and infer methods](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/indices-paths.html).

---

<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 3, 2017, 12:23am UTC](https://discuss.elastic.co/t/upgrade-from-nest-0-11-0-0-to-5-5-0-index-and-delete/99321/3 "2017-10-03T00:23:27Z")

</div>

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