elasticsearch.helpers.BulkIndexError: 500 document(s) failed to index

Viewed 59

I'm very new to this so I would appreciate help very much

Code is below:

import pandas as pd
from elasticsearch import Elasticsearch
from elasticsearch import helpers

elastic_user = "elastic"
elastic_password = "pass"
SOURCE = 'netflix_titles.csv'
netflix_df = pd.read_csv(SOURCE)

elastic_client = Elasticsearch("https://localhost:9200",verify_certs=False,basic_auth=(elastic_user,elastic_password))

def doc_generator(df):
    df_iter = df.iterrows()
    for index, document in df_iter:
        yield {
                "_index": "netflix_shows",
                "_source": document,
            }

helpers.bulk(elastic_client, doc_generator(netflix_df))

When I try to push the df into the index I get: elasticsearch.helpers.BulkIndexError: 500 document(s) failed to index.

0 Answers
Related