# Upgrading from Elasticsearch 5.x to 6.x - How to Create Index in C#

**URL:** https://discuss.elastic.co/t/upgrading-from-elasticsearch-5-x-to-6-x-how-to-create-index-in-c/170187
**Category:** Elasticsearch
**Created:** [February 27, 2019, 2:59pm UTC](https://discuss.elastic.co/t/upgrading-from-elasticsearch-5-x-to-6-x-how-to-create-index-in-c/170187 "2019-02-27T14:59:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Bobby\_Ortiz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bobby_ortiz/32/41368_2.png) [@Bobby\_Ortiz](https://discuss.elastic.co/u/Bobby_Ortiz)
#### Post date: [February 27, 2019, 2:59pm UTC](https://discuss.elastic.co/t/upgrading-from-elasticsearch-5-x-to-6-x-how-to-create-index-in-c/170187/1 "2019-02-27T14:59:00Z")

</div>

I have an application that has been working fine for years. Recently I am being forced to switch from Elasticsearch v5 to v6. I have a lot of .NET C# code that use the [Elasticsearch.Net](http://Elasticsearch.Net) and Elasticsearch Low Level APIs for .NET to communicate with Elasticsearch.

I found the list of all the [breaking changes](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/elasticsearch-net-breaking-changes.html#elasticsearch-net-breaking-changes).

What I need now, is a little more help and sample code.

In v5, I created an index like so:

```
var LowLevelClient = new ElasticLowLevelClient(_Settings);
var indexName = "MyIndexName";
PostData jsonPostData = CreateMappingJson(entityId);
var result = LowLevelClient.IndicesCreate<Object>(indexName, jsonPostData);
if (!result.Success)

```

On the page above of the breaking changes, you will see the following: Deleted: IndicesCreate(String, PostData, Func) Added: IndicesCreate(String, PostData, CreateIndexRequestParameters)

I am happy to change to the new method, but I don't understand. Do I have to create my own class that inherits from IElasticsearchResponse? Something like this?

```
public class MyResponse : IElasticsearchResponse
    {
        public MyResponse()
        {
        }

        public IApiCallDetails ApiCall { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }

        public bool TryGetServerErrorReason(out string reason)
        {
            throw new NotImplementedException();
        }
    }

```

If I do that, then I can update my original code to the following:

```
var result = LowLevelClient.IndicesCreate<MyResponse>(indexName, jsonPostData);
if (!result.ApiCall.Success)

```

That gets ride of the compiler errors.

My question is, what should my MyResponse class look like. I am sure what I have done will not work yet.

Thanks!

---

<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, 2019, 2:59pm UTC](https://discuss.elastic.co/t/upgrading-from-elasticsearch-5-x-to-6-x-how-to-create-index-in-c/170187/2 "2019-03-27T14:59:10Z")

</div>

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