# Issues during index where field is null after upgrade to 7.x

**URL:** <https://discuss.elastic.co/t/issues-during-index-where-field-is-null-after-upgrade-to-7-x/198262>\
**Category:** Elasticsearch\
**Created:** [September 5, 2019, 1:26pm UTC](https://discuss.elastic.co/t/issues-during-index-where-field-is-null-after-upgrade-to-7-x/198262 "2019-09-05T13:26:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dallas\_Toth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dallas_toth/32/22630_2.png) [@Dallas\_Toth](https://discuss.elastic.co/u/Dallas_Toth)\
**Post date:** [September 5, 2019, 1:26pm UTC](https://discuss.elastic.co/t/issues-during-index-where-field-is-null-after-upgrade-to-7-x/198262/1 "2019-09-05T13:26:51Z")

</div>

In previous versions of ES I have been able to send data in from SQL Server with fields that have null values. I know I needed to make some changes to the mapping to deal with the move from 5.x-6.x-7.x and I never had an issue sending in the data with fields with a null value till 7.x..  
The error I am getting is

```
Sep 05, 2019 08:09:32 AM: Sep 05, 2019 08:09:32 AM> Batch #1 Error, throwing exception...
Sep 05, 2019 08:09:32 AM: Failed to create entry in eventlog: Log entry string is too long. A string written to the event log cannot exceed 32766 characters.> ERROR[sp_vDash_NewClientsPatients]: System.Exception: Invalid NEST response built from a successful (200) low level call on POST: /_bulk
# Invalid Bulk items:
operation[0]: index returned 400 _index: logstash-hvms-ncp-kema-2019 _type: _doc _id: 709de0c7-df76-436a-86a2-33849020f443 _version: 0 error: Type: mapper_parsing_exception Reason: "failed to parse field [patientprofession] of type [text] in document with id '709de0c7-df76-436a-86a2-33849020f443'. Preview of field's value: '{}'" CausedBy: "Type: illegal_state_exception Reason: "Can't get text on a START_OBJECT at 1:243""
operation[1]: index returned 400 _index: logstash-hvms-ncp-kema-2019 _type: _doc _id: 378e55bd-6861-4e63-9e37-36903ab000ca _version: 0 error: Type: mapper_parsing_exception Reason: "failed to parse field [patientprofession] of type [text] in document with id '378e55bd-6861-4e63-9e37-36903ab000ca'. Preview of field's value: '{}'" CausedBy: "Type: illegal_state_exception Reason: "Can't get text on a START_OBJECT at 1:227""

```

I know because my current index's that were created in 6.x have null for fields  
"status": "Active",  
"patientprofession": null,  
"email": null,

I know there is a null\_value option to replace a null with a string and I have tried it but it did't do any replacing of those null's in the source and still failed to index with the same error. But I still would really like to get my data since the update to 7.x to continue to accept the null.

My mapping template  
PUT \_template/hvmsncp  
{  
"index\_patterns" : "logstash-hvms-ncp-_",  
"version" : 60001,  
"settings" : {  
"index.refresh\_interval" : "5s"  
},  
"mappings": {  
"dynamic\_templates" : [  
{"message\_field" :  
{"path\_match" : "message","match\_mapping\_type" : "string",  
"mapping" : {"norms" : false,"type" : "text"}  
}  
},  
{  
"string\_fields" : {"match" : "_","match\_mapping\_type" : "string",  
"mapping" : {  
"fields" : {"keyword" : {"type" : "keyword"}},"norms" : false,"type" : "text"}  
}  
}  
],  
"properties": {  
"@timestamp": {"type": "date"},  
....  
"patientprofession": {"type": "text","fields": {"keyword": { "type": "keyword"}}},  
....  
}  
}  
}

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![Dallas\_Toth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dallas_toth/32/22630_2.png) [@Dallas\_Toth](https://discuss.elastic.co/u/Dallas_Toth)\
**Post date:** [September 6, 2019, 5:15pm UTC](https://discuss.elastic.co/t/issues-during-index-where-field-is-null-after-upgrade-to-7-x/198262/2 "2019-09-06T17:15:06Z")

</div>

Anyone have a mapping solution to dealing with null values? I

---

<div class="post-metadata">

**Author:** ![Doc\_Kaos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/doc_kaos/32/53671_2.png) [@Doc\_Kaos](https://discuss.elastic.co/u/Doc_Kaos)\
**Post date:** [September 6, 2019, 8:20pm UTC](https://discuss.elastic.co/t/issues-during-index-where-field-is-null-after-upgrade-to-7-x/198262/3 "2019-09-06T20:20:51Z")

</div>

Using in your properties:

```auto
"patientprofession": {
   "type": "text",
   "null_value": "NULL"
}

```

Isn't working? [https://www.elastic.co/guide/en/elasticsearch/reference/current/null-value.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/null-value.html)

---

<div class="post-metadata">

**Author:** ![Dallas\_Toth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dallas_toth/32/22630_2.png) [@Dallas\_Toth](https://discuss.elastic.co/u/Dallas_Toth)\
**Post date:** [September 7, 2019, 6:20pm UTC](https://discuss.elastic.co/t/issues-during-index-where-field-is-null-after-upgrade-to-7-x/198262/4 "2019-09-07T18:20:01Z")

</div>

Are you using Elasticseach .NET to send your data into ES? I have tried the "null\_value": "NULL" in my mappings with no success I still get the errors from Elasticsearch .NET trying to send in the data.

Also that only works for strings and I believe it adds the string "NULL" instead of null which I need to work for numeric and date values as well.

---

<div class="post-metadata">

**Author:** ![Doc\_Kaos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/doc_kaos/32/53671_2.png) [@Doc\_Kaos](https://discuss.elastic.co/u/Doc_Kaos)\
**Post date:** [September 8, 2019, 9:26pm UTC](https://discuss.elastic.co/t/issues-during-index-where-field-is-null-after-upgrade-to-7-x/198262/5 "2019-09-08T21:26:58Z")

</div>

No, I'm not using .NET version. The "null\_value" has to be of the same type as the original field and yes it just replaces 'null' with a string or for numbers you could use -1 or 0 or whatever, but it has to be the same type as the original field.

The errors do seem wrong, maybe there's an issue with it for that version.

---

<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, 2019, 9:35pm UTC](https://discuss.elastic.co/t/issues-during-index-where-field-is-null-after-upgrade-to-7-x/198262/6 "2019-10-06T21:35:06Z")

</div>

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