# BulkIndexError: ('200 document(s) failed to index.'

**URL:** <https://discuss.elastic.co/t/bulkindexerror-200-document-s-failed-to-index/253780>\
**Category:** Elasticsearch\
**Created:** [October 30, 2020, 7:15am UTC](https://discuss.elastic.co/t/bulkindexerror-200-document-s-failed-to-index/253780 "2020-10-30T07:15:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![subham\_p](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@subham\_p](https://discuss.elastic.co/u/subham_p)\
**Post date:** [October 30, 2020, 7:15am UTC](https://discuss.elastic.co/t/bulkindexerror-200-document-s-failed-to-index/253780/1 "2020-10-30T07:15:45Z")

</div>

Hello Team,

I am trying to push approx 10000 data by converting the pandas data frame to elk.

But it fails to push all, some times it showing following error

failed to establish a new connection errno 111 connection refused  
failed to establish a new connection errno 110 connection timeout

#converting to dataframe  
df = DataFrame(result,columns=["summarized\_test\_data\_id","package\_id","panel\_id"]

#formatting the data  
def generator(df1):  
for c, line in enumerate(df1):  
yield {  
'\_index':''index\_name',  
#'\_type':''index\_name1',  
'\_type':'\_doc',  
'\_id':line.get('summarized\_test\_data\_id'),  
'\_source':{  
'summarized\_test\_data\_id':line.get('summarized\_test\_data\_id',['No Data']),  
'package\_id':line.get('package\_id',['No Data']),  
'panel\_id':line.get('panel\_id',['No Data']),  
'test\_id':line.get('test\_id',['No Data']),  
'loinc\_nm':line.get('loinc\_nm',['No Data']),  
}  
}

res=helpers.bulk(es,generator(df1),refresh=True,request\_timeout=3600)

it seems the following error,But in actual it pushed only 10 records to index

BulkIndexError: ('200 document(s) failed to index.', [{'index': {'\_index': 'in-dev-patient-summary-research5', '\_type': '\_doc', '\_id': '15765', 'status': 400, 'error': {'type': 'mapper\_parsing\_exception', 'reason': 'failed to parse', 'caused\_by': {'type': 'json\_parse\_exception', 'reason': "Non-standard token 'NaN': enable JsonParser.Feature.ALLOW\_NON\_NUMERIC\_NUMBERS to allow\n at [Source: (org.elasticsearch.common.bytes.AbstractBytesReference$MarkSupportingStreamInputWrapper); line: 1, column: 66]"}},

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 3, 2020, 12:06am UTC](https://discuss.elastic.co/t/bulkindexerror-200-document-s-failed-to-index/253780/2 "2020-11-03T00:06:54Z")

</div>

Welcome to our community! 😃

It looks like you have some non-numeric data in a numeric field?

---

<div class="post-metadata">

**Author:** ![subham\_p](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@subham\_p](https://discuss.elastic.co/u/subham_p)\
**Post date:** [November 3, 2020, 9:43am UTC](https://discuss.elastic.co/t/bulkindexerror-200-document-s-failed-to-index/253780/3 "2020-11-03T09:43:20Z")

</div>

Dear warkolm,  
As you said,this works fine numeric field only..  
But in actual my data format is in this manner..

```auto
"in-dev-patient-summary-research6" : {
    "aliases" : { },
    "mappings" : {
      "properties" : {
        "created_dttm" : {
          "type" : "date"
        },
        "created_usr_id" : {
          "type" : "long"
        },
        "hos_patient_id" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "isactive" : {
          "type" : "boolean"
        },
        "loinc_nm" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "org_grp_id" : {
          "type" : "long"
        },
        "org_id" : {
          "type" : "long"
        },
        "panel_id" : {
          "type" : "float"
        },
        "patient_id" : {
          "type" : "long"
        },
        "summarized_test_data_id" : {
          "type" : "long"
        },
        "test_id" : {
          "type" : "float"
        },
        "test_result" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "test_type" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }

```

```auto
"12345" : {
            "created_dttm" : "2020-04-08 17:17:56.379728",
            "created_usr_id" : 123456789,
            "hos_patient_id" : "P00000001",
            "isactive" : true,
            "loinc_nm" : null,
            "modified_dttm" : "None",
            "modified_usr_id" : null,
            "org_grp_id" : 1234,
            "org_id" : 2345,
            "package_id" : null,
            "panel_id" : null,
            "patient_id" : 1234567891011,
            "patient_visit_id" : 3456,
            "summarized_test_data_id" : 12345,
            "test_id" : 10111213,
            "test_result" : null,
            "test_type" : null,
            "version_id" : 1
          }, 

```

Can I store this format in elk ?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 4, 2020, 5:24am UTC](https://discuss.elastic.co/t/bulkindexerror-200-document-s-failed-to-index/253780/4 "2020-11-04T05:24:32Z")

</div>

Yes you can, but you cannot create a field as numeric and then try to store non-numeric data in there.  
You will need to remove/alter it before indexing.

---

<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:** [December 2, 2020, 5:24am UTC](https://discuss.elastic.co/t/bulkindexerror-200-document-s-failed-to-index/253780/5 "2020-12-02T05:24:35Z")

</div>

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