[Resolved]Failed to index by helpers.bulk

Hi team,

below is the python code.

from elasticsearch import helpers,Elasticsearch
import csv
es = Elasticsearch()
with open('testcase0801.csv') as f:
    reader = csv.DictReader(f)
    helpers.bulk(es,reader,index='testcase',doc_type='my_doc')

When I executing this, I got below error
File "C:\Users\I073341\AppData\Local\Continuum\anaconda3\lib\site-packages\elasticsearch\helpers_init_.py", line 137, in _process_bulk_chunk
raise BulkIndexError('%i document(s) failed to index.' % len(errors), errors)

`

BulkIndexError: ('93 document(s) failed to index.', [{'index': {'_index': 'testcase', '_type': 'my_doc', '_id': 'UfmR3GwBvy4j84MHhSUQ', 'status': 400, 'error': {'type': 'illegal_argument_exception', 'reason': 'Rejecting mapping update to [testcase] as the final mapping would have more than 1 type: [_doc, my_doc]'}, 'data': OrderedDict([('caseid', 'com.successfactors.test.qray.cases.talent.scm......
`
what's the issue here?

From v 6.0, Elasticsearch doesn't support multiple mapping types in one index.
In your case, you have more than 1 type:[_doc,my_doc]. Just set doc_type='_doc' can skip the issue.

1 Like

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