# Elasticsearch.Net/Nest issue with API after upgrade to 6.2.3

**URL:** <https://discuss.elastic.co/t/elasticsearch-net-nest-issue-with-api-after-upgrade-to-6-2-3/127690>\
**Category:** Elasticsearch\
**Created:** [April 11, 2018, 6:52pm UTC](https://discuss.elastic.co/t/elasticsearch-net-nest-issue-with-api-after-upgrade-to-6-2-3/127690 "2018-04-11T18:52:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![manojtrek](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@manojtrek](https://discuss.elastic.co/u/manojtrek)\
**Post date:** [April 11, 2018, 6:52pm UTC](https://discuss.elastic.co/t/elasticsearch-net-nest-issue-with-api-after-upgrade-to-6-2-3/127690/1 "2018-04-11T18:52:59Z")

</div>

In ES 5.6, using Nest API, we were doing Create operation using following code...

```
var descriptor = new BulkDescriptor();
descriptor.Index<JObject>(i => i
                                  .Index(esClient.IndexName)
                                  .Type(documentType)
                                  .Document(document));
esClient.Client.BulkAsync(descriptor);

```

This code used to work absolutely fine, and we were seeing the documents were inserting appropriately in the ES 5.6, example -

```
{
"_index": "lsss_2015_dummy",
"_type": "serviceobject",
"_id": "74401145-1751-4253-8dfe-a0200065e0b2",
"_version": 4266,
"_score": 1,
"_source": {
"ServiceId": "74401145-1751-4253-8dfe-a0200065e0b2",
"Version": "47b62897-c11f-4a17-8802-303cf912d119",
"Type": 1
}
}

```

After upgrading to ES 6.2.3 and Updating Nest/ES.NET API, this does not work anymore, it actually insert the document with the field, but document does not contains any values..  
example

```
{
"_index": "lsss_2015_dummy",
"_type": "serviceobject",
"_id": "74401145-1751-4253-8dfe-a0200065e0b2",
"_version": 4266,
"_score": 1,
"_source": {
"ServiceId": "",
"Version": "",
"Type": ""
}
}

```

Anyone had similar issue, or any comments on this about how to resolve it , I am not sure if it is because of jObject type, I looked at the upgrade documentation, didnt find anything related to it..

Please help.

---

<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:** [April 11, 2018, 10:26pm UTC](https://discuss.elastic.co/t/elasticsearch-net-nest-issue-with-api-after-upgrade-to-6-2-3/127690/2 "2018-04-11T22:26:47Z")

</div>

Could you please format your code using `</>` button in the toolbar; it makes the question much easier to read 🙂

> [@manojtrek](#):
>
> Anyone had similar issue, or any comments on this about how to resolve it , I am not sure if it is because of jObject type, I looked at the upgrade documentation, didnt find anything related to it..

If you're using `JObject` as the document type, or your document contains `JObject`, you will need to also reference the [`NEST.JsonNetSerializer` nuget package](https://www.nuget.org/packages/NEST.JsonNetSerializer/) and [hook up the `JsonNetSerializer`](https://www.nuget.org/packages/NEST.JsonNetSerializer/) as follows

```auto
var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var connectionSettings =
    new ConnectionSettings(pool, sourceSerializer: JsonNetSerializer.Default);

var client = new ElasticClient(connectionSettings);

```

This is required because [NEST 6.x removed the direct dependency on Json.NET](https://www.elastic.co/blog/nest-elasticsearch-net-6-0-ga) by IL-merging, internalizing and re-namespacing it. One of the changes this brings about is that now, NEST does not know how to specially handle `Newtonsoft.Json.Linq.JObject`, so the dependency on `NEST.JsonNetSerializer` which does know how to handle that type specially, is needed.

---

<div class="post-metadata">

**Author:** ![manojtrek](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@manojtrek](https://discuss.elastic.co/u/manojtrek)\
**Post date:** [April 11, 2018, 11:12pm UTC](https://discuss.elastic.co/t/elasticsearch-net-nest-issue-with-api-after-upgrade-to-6-2-3/127690/3 "2018-04-11T23:12:52Z")

</div>

Thanks so much Russ :), will format my code ...

---

<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:** [May 9, 2018, 11:12pm UTC](https://discuss.elastic.co/t/elasticsearch-net-nest-issue-with-api-after-upgrade-to-6-2-3/127690/4 "2018-05-09T23:12:57Z")

</div>

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