So I've been trying to learn Elasticsearch but I've been having a lot of problems. I'm trying to upload the first 150 rows of the csv file into Elasticsearch and while I can create the index, I'm not able to actually insert the csv file. I'm using Elasticsearch 7.11 and Kibana 7.11 along with Python 3.9 This is my code:
es = Elasticsearch([{'host': 'localhost', 'port': 9200}])
file = "information.csv"
read_csv = panda.read_csv(file)
beginning_of_file = read_csv.head(150)
elasticsearch.indices.delete(index='info_data', ignore=[400, 404])
elasticsearch.indices.create(index='info_data', ignore=400)
helpers.bulk(es, beginning_of_file, index='info_data')
I then get the following error:
elasticsearch.helpers.errors.BulkIndexError:
('18 document(s) failed to index.', [{'index': {'_index': 'movie_data', '_type': '_doc', '_id':
'KmwJwncBEtJeL_lPLqQ8', 'status': 400, 'error': {'type': 'mapper_parsing_exception', 'reason':
'failed to parse', 'caused_by': {'type': 'not_x_content_exception', 'reason': 'Compressor detection
can only be called on some xcontent bytes or compressed xcontent bytes'
Can anyone help me fix this error?
Thanks for any help you can provide.